ID: 28935 Updated by: [EMAIL PROTECTED] Reported By: khagiya1 at yahoo dot co dot jp -Status: Open +Status: Verified Bug Type: Class/Object related -Operating System: windows xp, 2000 +Operating System: * -PHP Version: 4.3.7 +PHP Version: 4CVS New Comment:
Output (with the script provided, with case 1!): ----------------------------------------------------- PHP Warning: String is not zero-terminated (x) (source: /usr/src/php4/Zend/zend_execute.c:281) in /home/jani/t.php on line 36 Warning: String is not zero-terminated (x) (source: /usr/src/php4/Zend/zend_execute.c:281) in /home/jani/t.php on line 36 x PHP Warning: String is not zero-terminated (ZZ Ì***) (source: /usr/src/php4/Zend/zend_execute_API.c:291) in Unknown on line 0 Warning: String is not zero-terminated (ZZ Ì***) (source: /usr/src/php4/Zend/zend_execute_API.c:291) in Unknown on line 0 [Sun Jul 11 21:38:02 2004] Script: 't.php' --------------------------------------- /usr/src/php4/Zend/zend_execute_API.c(291) : Block 0x08618F28 status: /usr/src/php4/Zend/zend_variables.c(44) : Actual location (location was relayed) Beginning: Cached (allocated on /usr/src/php4/Zend/zend_execute.c:911, 2 bytes) End: OK --------------------------------------- [Sun Jul 11 21:38:02 2004] Script: 't.php' --------------------------------------- /usr/src/php4/Zend/zend_execute.h(44) : Block 0xBFFFBCF4 status: Beginning: Overrun (magic=0x00420297, expected=0x7312F8DC) Fatal System Error: Raise at top of Exception Stack Aborted GDB backtrace: -------------- http://www.php.net/~jani/bug28935_gdb.bt Previous Comments: ------------------------------------------------------------------------ [2004-07-11 20:38:33] [EMAIL PROTECTED] PHP Warning: String is not zero-terminated (x) (source: /usr/src/web/php/php4/Zend/zend_execute.c:281) in /home/jani/t.php on line 36 Warning: String is not zero-terminated (x) (source: /usr/src/web/php/php4/Zend/zend_execute.c:281) in /home/jani/t.php on line 36 x PHP Warning: String is not zero-terminated (ZZ Ì***) (source: /usr/src/web/php/php4/Zend/zend_execute_API.c:291) in Unknown on line 0 Warning: String is not zero-terminated (ZZ Ì***) (source: /usr/src/web/php/php4/Zend/zend_execute_API.c:291) in Unknown on line 0 [Sun Jul 11 21:38:02 2004] Script: 't.php' --------------------------------------- /usr/src/web/php/php4/Zend/zend_execute_API.c(291) : Block 0x08618F28 status: /usr/src/web/php/php4/Zend/zend_variables.c(44) : Actual location (location was relayed) Beginning: Cached (allocated on /usr/src/web/php/php4/Zend/zend_execute.c:911, 2 bytes) End: OK --------------------------------------- [Sun Jul 11 21:38:02 2004] Script: 't.php' --------------------------------------- /usr/src/web/php/php4/Zend/zend_execute.h(44) : Block 0xBFFFBCF4 status: Beginning: Overrun (magic=0x00420297, expected=0x7312F8DC) Fatal System Error: Raise at top of Exception Stack Aborted ------------------------------------------------------------------------ [2004-06-28 03:26:30] khagiya1 at yahoo dot co dot jp 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 this bug report at http://bugs.php.net/?id=28935&edit=1