From: twilek at twilek dot hu
Operating system: Ubuntu Linux
PHP version: 5.2.6
PHP Bug Type: Reproducible crash
Bug description: __get, __set error when undefined class member
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 bug report at http://bugs.php.net/?id=45733&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45733&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45733&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45733&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45733&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45733&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45733&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45733&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45733&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45733&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45733&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45733&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45733&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45733&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45733&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45733&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45733&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45733&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45733&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45733&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45733&r=mysqlcfg