ID: 45733 Updated by: [EMAIL PROTECTED] Reported By: twilek at twilek dot hu -Status: Open +Status: Bogus Bug Type: Reproducible crash Operating System: Ubuntu Linux PHP Version: 5.2.6 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Using $this->$name in __get() creates an infinite recursion (it calls __get(), which calls __get(), etc), this is expected. Previous Comments: ------------------------------------------------------------------------ [2008-08-06 14:28:02] twilek at twilek dot hu Description: ------------ When i call the __get or __set with an invalid member variable, the php interpreter is crash. If i check the name with isset() then no crash! PHP Version 5.2.4-2ubuntu5.3 (newest version in ubuntu) Reproduce code: --------------- class Test { private $mVar = "var"; public function __get( $name ) { $name = "m" . $name; // if ( !isset( $this->$name ) ) return ""; //NO CRASH!! return $this->$name; } public function __set( $name, $value ) { $name = "m" . $name; // if ( !isset( $this->$name ) ) return; //NO CRASH!! $this->$name = $value; echo( "Set: \$this->" . $name . " = " . $value ); } } $t = new Test; echo "Good: " . $t->Var; echo "Bad: " . $t->Variable; $t->Variable = "test"; Expected result: ---------------- Good: "var" Bad: "" Set: $this->Variable = "test" Actual result: -------------- exit signal Segmentation fault (11) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45733&edit=1
