note 37837 added to function.extract

From: Date: Sat, 29 Nov 2003 00:44:11 +0000
Subject: note 37837 added to function.extract
Groups: php.notes 
Request: Send a blank email to php-notes+get-61100@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.extract.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37837 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37837&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37837&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61100) next »