#27951 [Opn]: debug_backtrace crash after using ++ on unassigned overloaded object property

From: Date: Sun, 11 Apr 2004 15:13:44 +0000
Subject: #27951 [Opn]: debug_backtrace crash after using ++ on unassigned overloaded object property
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-57917@lists.php.net to get a copy of this message
 ID:               27951
 User updated by:  calum at lasham dot com
 Reported By:      calum at lasham dot com
 Status:           Open
 Bug Type:         Reproducible crash
 Operating System: Windows XP
 PHP Version:      5CVS-2004-04-11 (dev)
 New Comment:

expected result should be a backtrace


Previous Comments:
------------------------------------------------------------------------

[2004-04-11 11:11:08] calum at lasham dot com

Description:
------------
When using the ++ operator on an overloaded object property that's not
assigned a value, a debug_backtrace() in another unrelated object
causes a crash.  See example code to reproduce the problem.

Note 1:  The script executes correctly if, in the example code...

$foo->bar++;

is replaced with...

$x = $foo->bar;
$x++;
$foo->bar = $x;

Note 2: if the __set method in class Setter actually sets the variable
on the object the script executes correctly.

The bug appears in php5rc1 and the snapshot Built On: Apr 11, 2004
10:30 GMT.  crash occurs when using php as apache module or from
command line.

Reproduce code:
---------------
<?php
class Setter {
   function __get($nm){ }
   function __set($nm, $val){ }
}

class Test {
	function backtrace(){
		debug_backtrace();
	}
}
$foo = new Setter();
$foo->bar++;

$t = new Test();
$t->backtrace();
?>

Expected result:
----------------
"got exception" printed

Actual result:
--------------
apache service crash


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27951&edit=1


Thread (3 messages)

« previous php.bugs (#57917) next »