HELP NEEDED Error array_merge()

A place for users and developers of the Xataface to discuss and receive support.

HELP NEEDED Error array_merge()

Postby jbrnz » Thu Sep 17, 2009 11:30 am

I can't figure out why I'm receiving the message below. I did do some changes to my tables through phpmyadmin, and made a small change to the view record template. Now everything works, but when I go to view the record I receive the error, and no view of the record is available.
Code: Select all
PHP Warning:  array_merge() [<a>function.array-merge</a>]: Argument #1 is not an array in /home/rpi/www/rpinet.com/dataface/Dataface/ConfigTool.php on line 198,


Here is the line from the configtool.php
Code: Select all
if ( strpos($entry, '>') !== false ){
                  list($newentry,$entryParent) = explode('>', $entry);
                  $this->config[$type][$tablename][trim($newentry)] = array_merge($this->config[$type][$tablename][trim($entryParent)],$config[$entry]);
               } else {
                  $this->config[$type][$tablename][$entry] =& $config[$entry];
               }
               
            }
jbrnz
 
Posts: 22
Joined: Mon Apr 20, 2009 11:20 am

Postby shannah » Thu Sep 17, 2009 1:36 pm

Looks like the problem is likely in your actions.ini file. You are likely overriding an action that doesn't exist yet. (most likely because of a typo).
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby jbrnz » Thu Sep 17, 2009 2:15 pm

Hi Steve,
Thank you for the direction. I have not setup any actions in the app. It must be using the default actions.ini. I am using this as an entry form.

I will dig for typos and see if I can fix the problem. If I find out what the problem is I will post the solution.
jbrnz
 
Posts: 22
Joined: Mon Apr 20, 2009 11:20 am

Postby shannah » Thu Sep 17, 2009 2:19 pm

I must be wrong then.. it wouldn't be the default one.

It is almost certainly a problem with one of the ini files though. Look through and see if you have any sections containing the '>' character. That is what it is complaining about.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby jbrnz » Sat Sep 19, 2009 11:45 am

Still have not been able to find out why the record view is not working as Admin or as a regular user. I have a separate app that works fine so I know it is in this app's directory. I have looked through and it does not appear the .ini files are the problem. I have setup the applications delegate as follows:

Code: Select all
class conf_ApplicationDelegate {   
    function getPermissions(&$record){
         $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
            if ( !isset($user) ) return Dataface_PermissionsTool::READ_ONLY();
      }
           function getPreferences(){
         $app =& Dataface_Application::getInstance();
         $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
         if ( $user && isAdmin($user->val('role')) ){
            return array();
         
         } else {
            return array(
               'show_result_stats'=>0,
               'show_jump_menu'=>0,
               'show_result_controller'=>0,
               'show_table_tabs'=>0,
               'show_actions_menu'=>0,
               'show_tables_menu'=>0,
               'show_search'=>0,
               'show_record_actions'=>0,
               'show_recent_records_menu'=>0,
               'show_record_tabs'=>0,
               'show_record_tree'=>0,
               'show_bread_crumbs'=>0);
         
         }
         }
}



I have made a couple changes to dataface_view_record and replaced a block in my table delegate.

table delegate:


Code: Select all
class tables_registrations {
   function after_action_new($params=array()){
       $record =& $params['record'];
       header('Location: '.$record->getURL('-action=view').'&--msg='.urlencode('Record Saved.'));
       exit;
      }
   function block__before_new_record_form(){
      echo <<<END
      
      <h1>Parish Resource Directory 2010</h1>
      <p>To place a listing for your company or organization fill in the form below.</p>
      <p><img></p>
END;
      
   }
   
   function block__custom_stylesheets(){
   
      echo <<<END
      <link>
END;
   function after_action_new(){
      $auth =& Dataface_AuthenticationTool::getInstance();
      $user =& $auth->getLoggedInUser();
      
      if ( !$user ){
         // The user is not logged in so we forward to a success page.
         header('Location: success.php');
         exit;
      }
   }
   }
}
?>


This page was setup using the example on the forum for registrations I adapted it from that. I notice I have put multiple after_action_new functions in this delegate could this be the problem? I also realize that I have not setup a success.php file at the end of the table delegate. Would this have any impact on the error I am receiving when the record is submitted? I can't think of what else would be causing this error. It would be easy to just start over with the app. however I would like to find out what I have done wrong. If you have any additional ideas to go after let me know.

Thanks
jbrnz
 
Posts: 22
Joined: Mon Apr 20, 2009 11:20 am

Postby shannah » Sat Sep 19, 2009 1:02 pm

The fact that it is the config tool complaining, and seeing where it is complaining, I can pretty much guarantee that the problem lay in an ini file.

Not in the xataface ini files, but in one of your app's ini files.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby jbrnz » Sat Sep 19, 2009 3:40 pm

Well I would absolutely take your word for it, so I deconstructed the field.ini file and everything work out just fine until I got to putting the various field groups together.

[fieldgroup:contact_info]
label="Your contact Infomration"
description = "Enter your contact information"

[fieldgroup:listing_info]
label="Information to be listed"
description = "Enter Company information below"
order = 0

Once I place the fields in the appropriate group they disappear. Any suggetions as to how to make them available in view?
jbrnz
 
Posts: 22
Joined: Mon Apr 20, 2009 11:20 am

Postby shannah » Sat Sep 19, 2009 3:46 pm

Those fieldgroup definitions look fine. What version of php are you using? 5.3 contains a bug with the parse_ini_file function.

What does the rest of your fields.ini file look like?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby jbrnz » Sat Sep 19, 2009 3:55 pm

Last time I looked i was using php 5.9

Here is the complete fields.ini with fieldgroup.

[registrantid]
visibility:list=hidden
visibility:find=hidden
visibility:browse=hidden
group=listing_info

[first_name]
widget:label = "First and Last Name"
widget:description = "will not show in directory listing"
group=contact_info

[last_name]
widget:label = "Phone"
widget:description = "will not show in directory listing"
group=contact_info

[email]
widget:label = "E-mail"
widget:description = "will not show in directory listing"
group=contact_info

[company]
widget:label = "Company Name"
widget:description = "Enter company name"
group=listing_info

[phone]
widget:label = "Company Phone"
widget:description = "Enter company phone"
group=listing_info

[fax]
widget:label = "Company Fax"
widget:description = "- optional -"
group=listing_info

[website]
widget:label = "Company Website"
widget:description = "Enter company website address"
group=listing_info

[companyemail]
widget:label = "Company Email"
widget:description = "Enter the contact email for your company"
group=listing_info

[address]
widget:label = "Company Address"
widget:description = "Enter the street address"
widget:type=textarea
group=listing_info

[company_profile]
widget:label = "Company Profile"
widget:description = "Company profile, medium, mission."
widget:type=textarea
group=listing_info

[merchandise]
widget:label = "Merchandise Handled"
widget:description = "products, services, events, authors, free materials, etc."
widget:type=textarea
group=listing_info

[category]
widget:label = "Category of services offered"
widget:type = "select"
vocabulary = "category"
group=listing_info

[area_of_interest_other]
widget:label = "Other"
widget:description = "If you selected other in the previous menu, please enter your category here."
group=listing_info

[withlogo]
widget:label = "Select to Include Logo"
widget:description = "If you select to include a company logo upload it in the following menu item."
group=listing_info

[logo]
Type = container
widget:type = file
allowed_extensions = jpg,tiff,png,pdf
widget:label = "Company Logo"
widget:description = "Add your company logo to your listing. Excepted formats .tiff,.jpg,.png,.pdf"
group=listing_info

[registration_date]
widget:type = hidden
group=listing_info

[fieldgroup:contact_info]
label="Your contact Infomration"
description = "Enter your contact information"

[fieldgroup:listing_info]
label="Information to be listed"
description = "Enter Company information below"
order = 0
jbrnz
 
Posts: 22
Joined: Mon Apr 20, 2009 11:20 am

Postby shannah » Sun Sep 20, 2009 1:07 am

Try moving your fieldgroup definitions to the top of your fields.ini file.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby jbrnz » Sun Sep 20, 2009 9:09 pm

I tried placing the fieldgroup definitions at the top of fields.ini file, but again it makes the fields disappear from view once the record has been saved. Once I remove the fieldgroup definitions the fields appear again in view.

Is it possible to asign fieldgroup definitions in the table delegate instead of the fields.ini?
jbrnz
 
Posts: 22
Joined: Mon Apr 20, 2009 11:20 am

Postby shannah » Mon Sep 21, 2009 7:31 am

Can you confirm your version of PHP again. I wasn't aware that 5.9 existed.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby jbrnz » Mon Sep 21, 2009 9:16 am

Hi Steve,
Sorry for the incorrect version number. I am using 5.2.9
jbrnz
 
Posts: 22
Joined: Mon Apr 20, 2009 11:20 am

Postby shannah » Mon Sep 21, 2009 12:31 pm

I'm at a bit of a loss as I can't see any reason why that shouldn't work. Is this on a new record form or a new_related_record form?

Are field groups working in any of your forms?

Can you run a test on your system:

File: testini1.ini
Code: Select all
[foo:bar]
   hello=world


File: test1.php
Code: Select all
<?php
$data = parse_ini_file('testini1.ini', true);
print_r($data);



And

File: test2ini.ini
Code: Select all
foo:bar=1


File: test2.php
Code: Select all
<?php
$data = parse_ini_file('test2ini.ini');
print_r($data);


Can you create the above files in the same directory and then run test1.php and test2.php and post the output of these scripts on the forum so I can see.

I'm wondering if 5.2.9 also contains a variation on the 5.3 bug.

Thanks
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: HELP NEEDED Error array_merge()

Postby strast » Sun Jan 17, 2010 12:01 pm

I had this same error message when I upgraded my Xataface.

Warning: array_merge() [<a>function.array-merge</a>]: Argument #1 is not an array...

The error was caused by my usage of the Email module which was suddenly missing after I wiped my old Xataface directory in favor of the update. I created a new xataface/modules directory and installed Email directory inside that with the Email_0.1 code and the system was back to normal.

..Steve
strast
 
Posts: 29
Joined: Thu Feb 05, 2009 6:14 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 21 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved