|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-21 17:31 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 03:00:02 2025 UTC |
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