ID: 22367 User updated by: stanislav dot chachkov at epfl dot ch Reported By: stanislav dot chachkov at epfl dot ch Status: Verified Bug Type: Scripting Engine problem Operating System: Solaris8 PHP Version: 4.3.2-dev New Comment:
We found a workaround: getColumnValue functions should both return a reference or both return a value. Actually it is also possible to return a reference from class A and value from sub class B, but the inverse breaks the stack. Previous Comments: ------------------------------------------------------------------------ [2003-02-24 01:44:27] stanislav dot chachkov at epfl dot ch 1) This code works fine with previous version (4.2.2) 2) What exactly in this code is 'weird'/'irrealistic'? I'm ready to explain you how does it works, or else you can ask any people who deals with object orientation at php 3) It is really a problem for me, because i have a broken web site just because i did an update from v4.2.2 to v4.3.2 to use GD image lib. Best regards. ------------------------------------------------------------------------ [2003-02-23 18:01:01] [EMAIL PROTECTED] 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?) ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22367 -- Edit this bug report at http://bugs.php.net/?id=22367&edit=1