|  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-12-07 16:31 UTC] lars_stegelitz at col dot wunderman dot com
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;


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

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

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.


Add a Patch

Pull Requests

Add a Pull Request


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

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]
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/

 [2005-12-24 02:16 UTC]
Please try using this CVS snapshot:
For Windows:

 [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: Tue Apr 16 16:01:28 2024 UTC