php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78908 error_get_last() has limited stack trace
Submitted: 2019-12-04 11:35 UTC Modified: 2021-12-01 17:52 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: sailormax at inbox dot lv Assigned: cmb (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.4.0 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
21 + 48 = ?
Subscribe to this entry?

 
 [2019-12-04 11:35 UTC] sailormax at inbox dot lv
Description:
------------
default Exception handler and error_get_last() return error message with not full stack trace. When use large libraries like PHPSpreadsheet and got exception, message with stack trace contain only PHPSpreadsheet internal calls but where you call it is offcut.

Test script:
---------------
<?
	$limiter = 20;
	$func = function() use (&$limiter, &$func)
	{
		$limiter--;
		if (!$limiter)
		{
			print "<pre>";
			debug_print_backtrace();
			throw new Exception("test error");
		}

		if ($limiter <= 0)
			return;
		$func();
	};

	$func();
?>

Expected result:
----------------
0  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#1  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#2  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#3  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#4  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#5  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#6  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#7  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#8  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#9  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#10 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#11 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#12 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#13 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#14 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#15 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#16 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#17 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#18 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#19 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]


Fatal error:  Uncaught Exception: test error in D:\max\Documents\GitHub\atom\test.php:9
Stack trace:
#0 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#1 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#2 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#3 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#4 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#5 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#6 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#7 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#8 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#9 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#10 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#11 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#12 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#13 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#14 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#15 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#16 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#17 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#18 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#19 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
in D:\max\Documents\GitHub\atom\test.php on line 9

Actual result:
--------------
0  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#1  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#2  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#3  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#4  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#5  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#6  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#7  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#8  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#9  {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#10 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#11 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#12 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#13 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#14 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#15 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#16 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#17 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#18 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]
#19 {closure}() called at [D:\max\Documents\GitHub\atom\test.php:14]


Fatal error:  Uncaught Exception: test error in D:\max\Documents\GitHub\atom\test.php:9
Stack trace:
#0 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#1 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#2 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#3 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#4 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#5 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#6 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#7 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#8 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#9 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#10 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#11 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#12 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#13 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#14 D:\max\Documents\GitHub\atom\test.php(14): {closure}()
#1 in D:\max\Documents\GitHub\atom\test.php on line 9

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-04 13:03 UTC] sjon@php.net
there must be something else limiting the depth, because I cannot reproduce this. See https://3v4l.org/VhoFu - as you can see the exception backtrace is just as deep as the debug-backtrace is (unless this is Windows specific)
 [2019-12-04 13:03 UTC] sjon@php.net
-Status: Open +Status: Feedback
 [2019-12-04 13:20 UTC] sailormax at inbox dot lv
Can I get ini-file from 3v4l.org ?

try to increase $limiter to 50 on 3v4l.org. You will see the same problem.
 [2019-12-15 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2019-12-15 08:41 UTC] nikic@php.net
-Status: No Feedback +Status: Re-Opened
 [2019-12-15 08:41 UTC] nikic@php.net
Per previous comment: https://3v4l.org/6QGXt
 [2021-12-01 17:52 UTC] cmb@php.net
-Status: Re-Opened +Status: Closed -Package: Unknown/Other Function +Package: Scripting Engine problem -Assigned To: +Assigned To: cmb
 [2021-12-01 17:52 UTC] cmb@php.net
According to <https://3v4l.org/6QGXt>, this is fixed as of PHP
8.0.0, and since PHP-7.4 won't receive any regular bug fixes, I'm
closing this ticket.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC