NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP 5 guru: help fix simple PEAR DB problem

Dan Cech dcech at phpwerx.net
Mon Feb 2 00:10:04 EST 2004


Daniel Convissor wrote:

> Hi Folks:
> 
> I just uploaded the latest release of PEAR DB, 1.6.0RC3.
> 
> Can someone who's more familliar with PHP 5 than I please help fix the 
> following problem?
> 
> The DB_common::getAssoc() method works fine in PHP 4 but is producing
> really weird results under PHP 5.  If you're wondering, PHP 5 is a windows
> snapshot from today.

Ok, looking again the issue I mentioned is not going to cause your 
problem...it's definitely a tricky one...

My guess would be that it is somehow related to the PHP5 behaviour of 
returning objects by reference rather than by value...it is possible 
that you have some odd reference problem happening, which would explain 
why the initial print_r debugging works but once the second loop goes 
through there are problems.

I would be tempted to put an unset($row); at the end of your while loop 
just to make sure that you are not unwittingly overwriting any references...

Dan




More information about the talk mailing list