Bug #72774 [Asn->Csd]: Exception backtrace produces unexpected values
Edit report at https://bugs.php.net/bug.php?id=72774&edit=1
ID: 72774
Updated by: cmb@php.net
Reported by: eyalt@php.net
Summary: Exception backtrace produces unexpected values
-Status: Assigned
+Status: Closed
Type: Bug
Package: Variables related
Operating System: Linux
PHP Version: 7.0.9
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2016-08-07 17:19:48] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=339817
Log: Fix #72774: Exception backtrace produces unexpected values
------------------------------------------------------------------------
[2016-08-07 16:57:12] cmb@php.net
As of PHP 7.0.0 this is expected behavior, that is described in
UPGRADING[1].
I couldn't find it being listed in the migration guide in the
manual, though, so I'm switching to doc bug.
[1] <https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L215-L240>
------------------------------------------------------------------------
[2016-08-07 13:56:10] eyalt@php.net
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 this bug report at https://bugs.php.net/bug.php?id=72774&edit=1
Thread (3 messages)