note 37837 deleted from function.extract by aidan

From: Date: Thu, 09 Sep 2004 09:14:17 +0000
Subject: note 37837 deleted from function.extract by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76290@lists.php.net to get a copy of this message
Note Submitter: moc dot aidemvu at semaj ---- Be carefull when following the here-recommended process for processing class constructer func_args into properties of the class. PHP produces some strange errors in some cases when you refer to a class attribute that was not defined in the class definiton. In particular I have found method of non-object errors code completely removed from the class definition and object interaction and definition. Bug hunting for this is difficult as the error source behaves as though it moves. // similar explicit example class MyClass { var $defined; function MyClass() { } } $MyObject = new MyClass; $FirstVar = $MyObject->defined; // works fine $MyVar = $MyObject->undefinedVariable; // sometimes produces the error $MyObject->undefinedVariable = "{some value}" // this makes everything work (WHETHER OR NOT IT SHOULD WORK) The bug really seems to occur if one instance of the class has the undeclared variable assigned, but another doesn't.

« previous php.notes (#76290) next »