|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-08-06 14:38 UTC] lbarnaud@php.net
[2008-08-07 08:21 UTC] twilek at twilek dot hu
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 21:00:01 2025 UTC |
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)