From:             calum at lasham dot com
Operating system: Windows XP
PHP version:      5CVS-2004-04-11 (dev)
PHP Bug Type:     Reproducible crash
Bug description:  debug_backtrace crash after using ++ on unassigned overloaded object 
property

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 bug report at http://bugs.php.net/?id=27951&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27951&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27951&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27951&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27951&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27951&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27951&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27951&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27951&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27951&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27951&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27951&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27951&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27951&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27951&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27951&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27951&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27951&r=float

Reply via email to