From: khagiya1 at yahoo dot co dot jp
Operating system: windows xp, 2000
PHP version: 4.3.7
PHP Bug Type: Class/Object related
Bug description: Operation is amusing when a constant is set up by __set to the
overloaded class
Description:
------------
When __set is called to the class by which the overload was carried out,
operation by FOO and constant ('FOO') is different.
Reproduce code:
---------------
<?php
define( 'FOO', 'BAR' );
class line
{
var $_data = array();
function set( $key, $value )
{
$this->_data[$key] = $value;
}
function get( $key )
{
return $this->_data[$key];
}
}
class Info
{
var $_data = null;
function Info( & $line )
{
$this->_data = array( & $line );
}
function __set( $key, $value )
{
$data =& $this->_data;
$data[0]->set( $key, $value );
return TRUE;
}
function __get( $key, &$value )
{
$data = $this->_data;
$ret =& $data[0]->get( $key );
$value = $ret;
return TRUE;
}
}
overload( 'Info' );
$test = new Info( new line );
// [case 1 = fail]
$test->x = FOO;
echo $test->x;
// [case 2 = success]
//$test->x = constant('FOO');
//echo $test->x;
// [case 3 = crash!!!!!]
// When it calls simultaneously
//$test->x = FOO;
//$test->y = constant('FOO');
?>
Expected result:
----------------
//[case 1]
BAR
//[case 2]
BAR
//[case 3]
BAR
BAR
Actual result:
--------------
//[case 1]
xR (why???)
//[case 2]
BAR (ok!!!)
//[case 3]
segfault!!!!!
--
Edit bug report at http://bugs.php.net/?id=28935&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28935&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28935&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28935&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28935&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28935&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28935&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28935&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28935&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28935&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28935&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28935&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28935&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28935&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28935&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28935&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28935&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28935&r=float