ID: 22367 Updated by: [EMAIL PROTECTED] Reported By: stanislav dot chachkov at epfl dot ch -Status: Verified +Status: Closed Bug Type: Scripting Engine problem Operating System: Solaris8 PHP Version: 4.3.2-dev New Comment:
This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2003-03-24 04:31:15] [EMAIL PROTECTED] Related to bug #22836 ------------------------------------------------------------------------ [2003-02-24 15:11:48] stanislav dot chachkov at epfl dot ch 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. ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ 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