Bug #78908 [Opn]: error_get_last() has limited stack trace

From: Date: Wed, 04 Dec 2019 13:03:40 +0000
Subject: Bug #78908 [Opn]: error_get_last() has limited stack trace
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224060@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78908&edit=1

 ID:                 78908
 Updated by:         sjon@php.net
 Reported by:        sailormax at inbox dot lv
 Summary:            error_get_last() has limited stack trace
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Windows 10
 PHP Version:        7.4.0
 Block user comment: N
 Private report:     N

 New Comment:

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)


Previous Comments:
------------------------------------------------------------------------
[2019-12-04 11:35:32] 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


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78908&edit=1


Thread (7 messages)

« previous php.bugs (#224060) next »