Categories > TinyButStrong general >

PHP 5.1.2 and 2-D array merge

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Al
Date: 2006-01-18
Time: 15:29

PHP 5.1.2 and 2-D array merge

Since upgrading to PHP 5.1.2, and not changing any PHP or TBS code, I am getting this error:

br /><b>TinyButStrong Error</b> (Object or Array value expected): Can't merge &#91;result.pp_pay_patient_name] because the item before 'pp_pay_patient_name' is neither an object nor an array. Its type is string. <em>This message can be cancelled using parameter 'noerr'.</em><br />

I merge a 2-D array:

$TBS->MergeBlock('result', $payment_adjustment->PmtsArray);

Then display the results:

[result.pp_pay_patient_name;magnet=td;block=tr;]

This has worked fine for some time until the upgrade. Is there an issue with TBS and PHP 5.1.2? That data is in the array at the time of merge (print_r displays it).
By: Skrol29
Date: 2006-01-18
Time: 17:44

Re: PHP 5.1.2 and 2-D array merge

Hello,

How $payment_adjustment->PmtsArray is feeded ?
By: Skrol29
Date: 2006-01-18
Time: 17:46

Re: PHP 5.1.2 and 2-D array merge

And what was your previous PHP 5 version ?
By: Al
Date: 2006-01-18
Time: 18:17

Re: PHP 5.1.2 and 2-D array merge

To fill the array we just query a db and fill each value. We just loop through each payment and fill the array with its db values. Like:

for each payment key
   $this->PmtsArray[$key]['id'] = $dbP->f("id");

Where $dbP->f access a db value from a query.

The previous PHP version was 5.0.5. Apache was also upgraded to 1.3.4.
Probably this isn't a problem with TBS, but something that was broke during the update.
The code is still working fine on another machine running PHP 5.0.5.

Does the error message give any clues? What causes it to be thrown?
By: Skrol29
Date: 2006-01-18
Time: 18:40

Re: PHP 5.1.2 and 2-D array merge

The message is not giving any clue exept that the data is probably not an array structred as expected.
  $payment_adjustment->PmtsArray[$key]['pp_pay_patient_name'] = a value.

This may have something to do with your database connectivity tool.

Could you simply do an var_export() of $payment_adjustment->PmtsArray just before the MergeBlock(), when it run bad ?

Can you post or send to me the string produced by this var_export() ?
This will help us to see what's wrong, and if all seems ok, to reproduce the problem.
By: Al
Date: 2006-01-18
Time: 18:52

Re: PHP 5.1.2 and 2-D array merge

I sent you a zip file of the export. Password is 'allen'.
By: Al
Date: 2006-01-18
Time: 20:06

Re: PHP 5.1.2 and 2-D array merge

Well we fixed the bug. Three keys were not present in the array, but the tbs code called them with a magnet. Prior to PHP 5.1 this was not a problem, probably TBS assumed null (nonexisting) = blank. But now a TBS error occurs, the one previously mentioned, and the whole merge fails. This is probably the correct behavior we just never noticed the problem because no errors occured.
Thanks for all your help!