[ciapug] PHP 5.2.x : __toString stuff

David Champion dchampion at visionary.com
Mon Nov 24 14:07:23 CST 2008


The server is owned by another company, I'm doing the work as a 
contractor. They had updated the PHP version a while back without 
telling me, this is the only place in the system (that I've found) where 
this issue cropped up.

We've updated the Dev server to 5.2.6, and will be updating the Live 
server to that version as well.

The "distro" in this case is Windows Server 2003. (Not by my choice).

-dc

Wade Arnold wrote:
> David I an curiuse as to why you upgraded to 5.2 and not 5.2.6 ? Was 
> that the distro and if so what distro ?
>
> Wade
>
> Sent from my iPhone
>
> On Nov 21, 2008, at 2:25 PM, "David Champion" <dchampion at visionary.com 
> <mailto:dchampion at visionary.com>> wrote:
>
>> I ran across an issue in an existing system, where a server got upgraded
>> to PHP 5.2.0 from 5.1.4, and it started throwing this error:
>>
>> "Catchable fatal error: Object of class stdClass could not be converted
>> to string in.."
>>
>> Here's a thread that explains and / or complains about the issue:
>>
>> http://bugs.php.net/bug.php?id=41221
>>
>> In my case, I was able to do a quick fix - it was referencing the ADODB
>> result set's method FetchField like this:
>>
>> $field = $this->results->FetchField($col);
>>
>> I changed it to this:
>>
>> $field = $this->results->FetchField[$col];
>>
>> ... and it fixed the issue, since it's now returning the array element
>> instead of making a function call that returns a string.
>>
>> Anyway, just something some of you may need to look out for when
>> upgrading PHP. Looking around for solutions, I saw that this affects
>> various 3rd party apps & libraries like forums and shopping cart
>> applications, so... be sure and test before you upgrade.
>>
>> Somewhere along the way, among some documentation about __toString() and
>> the other "magic functions", there was a mention that this behavior may
>> change in the future too.
>>
>> -dc
>>
>>
>> _______________________________________________
>> ciapug mailing list
>> ciapug at cialug.org <mailto:ciapug at cialug.org>
>> http://cialug.org/mailman/listinfo/ciapug
>>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>   




More information about the ciapug mailing list