php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27951 debug_backtrace crash after using ++ on unassigned overloaded object property
Submitted: 2004-04-11 11:11 UTC Modified: 2004-04-12 19:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: calum at lasham dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2004-04-11 (dev) OS: Windows XP
Private report: No CVE-ID: None
 [2004-04-11 11:11 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-11 11:13 UTC] calum at lasham dot com
expected result should be a backtrace
 [2004-04-12 19:44 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Seems to be fixed in CVS (at least on Linux..)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 01:01:33 2024 UTC