forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds an INI setting, 'error_backtrace_recording', which users can set to an error mask to enable backtraces for those errors. It defaults to E_FATAL_ERRORS, meaning that any non-recoverable error will now have a backtrace associated with it. For example, a script timeout will now look like: Fatal error: Maximum execution time of 1 second exceeded in example.php on line 23 Stack trace: #0 example.php(23): usleep(10000) php#1 example.php(24): recurse() php#2 example.php(24): recurse() ... It respects the `zend.exception_ignore_args` INI setting and the SensitiveParameter attributes, so users can ensure that sensitive arguments do not end up in the backtrace.
- Loading branch information
1 parent
b01f5e3
commit 320db3b
Showing
10 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--TEST-- | ||
Fatal error backtrace | ||
--FILE-- | ||
<?php | ||
|
||
$argv[1] = "stdClass"; | ||
|
||
include __DIR__ . '/new_oom.inc'; | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes) in %snew_oom.inc on line %d | ||
Stack trace: | ||
#0 %snew_oom.inc(%d): ReflectionClass->newInstanceWithoutConstructor() | ||
#1 %serror_backtrace_recording_001.php(%d): include('%s') | ||
#2 {main} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
Fatal error backtrace w/ sensitive parameters | ||
--FILE-- | ||
<?php | ||
|
||
function oom(#[\SensitiveParameter] $unused) { | ||
$argv[1] = "stdClass"; | ||
|
||
include __DIR__ . '/new_oom.inc'; | ||
} | ||
|
||
oom("foo"); | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes) in %snew_oom.inc on line %d | ||
Stack trace: | ||
#0 %snew_oom.inc(%d): ReflectionClass->newInstanceWithoutConstructor() | ||
#1 %serror_backtrace_recording_002.php(%d): include(%s) | ||
#2 %serror_backtrace_recording_002.php(%d): oom(Object(SensitiveParameterValue)) | ||
#3 {main} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--TEST-- | ||
Fatal error backtrace w/ zend.exception_ignore_args | ||
--FILE-- | ||
<?php | ||
|
||
ini_set('zend.exception_ignore_args', true); | ||
|
||
function oom($unused) { | ||
$argv[1] = "stdClass"; | ||
|
||
include __DIR__ . '/new_oom.inc'; | ||
} | ||
|
||
oom("foo"); | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes) in %snew_oom.inc on line %d | ||
Stack trace: | ||
#0 %snew_oom.inc(%d): ReflectionClass->newInstanceWithoutConstructor() | ||
#1 %serror_backtrace_recording_003.php(%d): include(%s) | ||
#2 %serror_backtrace_recording_003.php(%d): oom() | ||
#3 {main} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters