ID: 22367 Updated by: [EMAIL PROTECTED] Reported By: stanislav dot chachkov at epfl dot ch -Status: Open +Status: Verified -Bug Type: Variables related +Bug Type: Scripting Engine problem Operating System: Solaris8 -PHP Version: 4.3.0 +PHP Version: 4.3.2-dev New Comment:
I do get similar results plus some leaks with your example..but your example is quite weird code which really shouldn't work anyway. :) And btw. undefined variables have 'value' of NULL.. (unset($var) is same as doing $var = NULL;) Testing whether a variable exists should always be done with 'isset()'. Leaving as verified but I'm not sure if this will ever get 'fixed'. (try come up with some more realistic example?) Previous Comments: ------------------------------------------------------------------------ [2003-02-23 13:16:25] stanislav dot chachkov at epfl dot ch This is the test case: <? class A{ var $fields; function getID(){ return $this->getColumnValue($this->getPK()); } function getColumnValue($col_name){ return $this->fields[$col_name]; } function save(){ $this->getID(); $i=333; echo "Dump of z: "; var_dump($z); echo "<br>z="; echo $z; echo "<br>"; if($boo){ echo "undefined is now defined<br>"; }else{ echo "undefined is undefined<br>"; } $s1="YES"; $s2="NO"; echo "s1=$s1, s2=$s2"; } } class B extends A{ function getPK(){ return "ID"; } function &getColumnValue($col_name){ return parent::getColumnValue($col_name); } } $b=new B(); if(!$b->getID()){} $b->save(); ?> The output that we have is: Dump of z: NULL z=333 undefined is now defined s1=NO, s2=NO ------------------------------------------------------------------------ [2003-02-23 11:56:04] stanislav dot chachkov at epfl dot ch Exactly the same behaviour with php 4.3.2-dev We will try to write a simple test case ------------------------------------------------------------------------ [2003-02-23 01:26:27] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip It might have been fixed. If not, then put that long example somewhere to be downloaded and add the url here. ------------------------------------------------------------------------ [2003-02-21 17:31:45] stanislav dot chachkov at epfl dot ch In a method we have that ($a is undefined, but this also works if you substitute $a by any other name): function getColumnValue($col_name){ var_dump($a); echo "a=$a <br>"; ... } This method is called a number of times and the output is like this: NULL a= NULL a= ... NULL a=Etape_Editor_IDEtape_Editor_ID'' Actually "EtapeEditor_ID" was the parameter of PREVIOUS call to one of methods of this class. I can not reproduce this problem with a short script, it seems that it appears only when the number of classes, objects and calls is large, otherwise it works fine. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22367&edit=1