Bug #72774 [NEW]: Exception backtrace produces wrong integer values when passed by reference
From: eyalt
Operating system: Linux
PHP version: 7.0.9
Package: Variables related
Bug Type: Bug
Bug description:Exception backtrace produces wrong integer values when passed by reference
Description:
------------
Exception backtrace produces wrong integer values when passed by
reference - a regression VS PHP 5.x, as can be seen in the test script.
Test script:
---------------
<pre><?php
function recurse_bug($count) {
if ($count) {
return recurse_bug(--$count); // if we use instead $count - 1, then BT
will be prodcued OK on PHP 7 too
}
$e = new Exception();
print $e->getTraceAsString();
}
recurse_bug(2);
/* On PHP 5.x we will get the correct BT:
#0 /var/www/html/frontend/scrap.php(4): recurse_bug(0)
#1 /var/www/html/frontend/scrap.php(4): recurse_bug(1)
#2 /var/www/html/frontend/scrap.php(9): recurse_bug(2)
#3 {main}
On PHP 7.x we will get the following wrong BT:
#0 /var/www/html/frontend/scrap.php(4): recurse_bug(0)
#1 /var/www/html/frontend/scrap.php(4): recurse_bug(0)
#2 /var/www/html/frontend/scrap.php(9): recurse_bug(1)
#3 {main} */
Expected result:
----------------
#0 /var/www/html/frontend/scrap.php(4): recurse_bug(0)
#1 /var/www/html/frontend/scrap.php(4): recurse_bug(1)
#2 /var/www/html/frontend/scrap.php(9): recurse_bug(2)
#3 {main}
Actual result:
--------------
#0 /var/www/html/frontend/scrap.php(4): recurse_bug(0)
#1 /var/www/html/frontend/scrap.php(4): recurse_bug(0)
#2 /var/www/html/frontend/scrap.php(9): recurse_bug(1)
#3 {main} */
--
Edit bug report at https://bugs.php.net/bug.php?id=72774&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72774&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72774&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72774&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72774&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72774&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72774&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72774&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72774&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72774&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72774&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72774&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72774&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72774&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72774&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72774&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72774&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72774&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72774&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72774&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72774&r=mysqlcfg
Thread (3 messages)
- eyalt@php.net