php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31010 unset crashes overloaded class
Submitted: 2004-12-07 16:31 UTC Modified: 2006-01-01 01:00 UTC
From: lars_stegelitz at col dot wunderman dot com Assigned:
Status: No Feedback Package: Class/Object related
PHP Version: 4CVS-2005-06-27 OS: *
Private report: No CVE-ID: None
 [2004-12-07 16:31 UTC] lars_stegelitz at col dot wunderman dot com
Description:
------------
When trying to echo an variable that was previously unset, no output at all is shown. I wrote a small test case (see below)






Reproduce code:
---------------
class Test
{
	var $values;

	function Test() {
		$this->values = array();
	}
	
	function __get($key, &$value) {
		$value = @$this->values[$key];
		return true;
	}
	
	function __set($key, $value) {
		$this->values[$key] = @$value;
		return true;
	}
}

overload('Test');

$test = new Test();
$test->xyz = "test";
echo "<br/>1. {$test->xyz}";
unset($test->values['xyz']);
echo "<br/>2. {$test->xyz}";


Expected result:
----------------
1. test
Notice: Undefined variable: xyz in <sourcecode> on line <x>
2. 



Actual result:
--------------
Nothing. No output at all. No warning or error in log files or on screen. Not even the echo *before* unsetting the variable shows up.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-07 16:38 UTC] lars_stegelitz at col dot wunderman dot com
addition:

The error-suppression operator (@) in the __set/__get methods should be omitted to see a warning in standard cases. However, it makes no difference in case of the mentioned error...
 [2004-12-08 07:56 UTC] sniper@php.net
Most likely the lack of output is because there is a crash in PHP, backtrace as follows:

[Switching to Thread 1087948032 (LWP 19451)]
0x082a359c in execute (op_array=0x8624c4c) at /usr/src/web/php/php4/Zend/zend_execute.c:1370
1370                                    PZVAL_UNLOCK(*EX(Ts)[EX(opline)->result.u.var].var.ptr_ptr);
(gdb) bt
#0  0x082a359c in execute (op_array=0x8624c4c)
    at /usr/src/web/php/php4/Zend/zend_execute.c:1370
#1  0x08290eed in zend_execute_scripts (type=8, retval=0x0, file_count=3)
    at /usr/src/web/php/php4/Zend/zend.c:900
#2  0x082589f9 in php_execute_script (primary_file=0xbfffe490)
    at /usr/src/web/php/php4/main/main.c:1736
#3  0x082b68e9 in main (argc=2, argv=0xbfffe524)
    at /usr/src/web/php/php4/sapi/cli/php_cli.c:822
#4  0x42015704 in __libc_start_main () from /lib/tls/libc.so.6

 [2005-12-24 02:16 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-01-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC