undefined variable has a value
| Bug #22367 | undefined variable has a value | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2003-02-21 17:31 UTC | Modified: | 2003-08-26 23:24 UTC |
|
||||||||||
| From: | stanislav dot chachkov at epfl dot ch | Assigned: | ||||||||||||
| Status: | Closed | Package: | Scripting Engine problem | |||||||||||
| PHP Version: | 4.3.0 | OS: | Solaris8 | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[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.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2003-02-23 13:16 UTC] 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-24 15:11 UTC] stanislav dot chachkov at epfl dot ch
[2003-08-26 23:24 UTC] sniper@php.net