-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
see https://wiki.php.net/rfc/error_backtraces_v2 Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
- Loading branch information
1 parent
5bf6e2e
commit 0a14ab1
Showing
15 changed files
with
166 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--TEST-- | ||
Fatal error backtrace | ||
--INI-- | ||
fatal_error_backtraces=On | ||
--FILE-- | ||
<?php | ||
|
||
eval("class Foo {}; class Foo {}"); | ||
?> | ||
--EXPECTF-- | ||
Fatal error: Cannot redeclare class Foo (%s) in %s : eval()'d code on line %d | ||
Stack trace: | ||
#0 %sfatal_error_backtraces_001.php(%d): eval() | ||
#1 {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,19 @@ | ||
--TEST-- | ||
Fatal error backtrace w/ sensitive parameters | ||
--INI-- | ||
fatal_error_backtraces=On | ||
--FILE-- | ||
<?php | ||
|
||
function trigger_fatal(#[\SensitiveParameter] $unused) { | ||
eval("class Foo {}; class Foo {}"); | ||
} | ||
|
||
trigger_fatal("bar"); | ||
?> | ||
--EXPECTF-- | ||
Fatal error: Cannot redeclare class Foo (%s) in %s : eval()'d code on line %d | ||
Stack trace: | ||
#0 %sfatal_error_backtraces_002.php(%d): eval() | ||
#1 %sfatal_error_backtraces_002.php(%d): trigger_fatal(Object(SensitiveParameterValue)) | ||
#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,20 @@ | ||
--TEST-- | ||
Fatal error backtrace w/ zend.exception_ignore_args | ||
--INI-- | ||
fatal_error_backtraces=On | ||
zend.exception_ignore_args=On | ||
--FILE-- | ||
<?php | ||
|
||
function trigger_fatal($unused) { | ||
eval("class Foo {}; class Foo {}"); | ||
} | ||
|
||
trigger_fatal("bar"); | ||
?> | ||
--EXPECTF-- | ||
Fatal error: Cannot redeclare class Foo (%s) in %s : eval()'d code on line %d | ||
Stack trace: | ||
#0 %sfatal_error_backtraces_003.php(%d): eval() | ||
#1 %sfatal_error_backtraces_003.php(%d): trigger_fatal() | ||
#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
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
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
59 changes: 59 additions & 0 deletions
59
ext/standard/tests/general_functions/error_get_last_002.phpt
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,59 @@ | ||
--TEST-- | ||
error_get_last() w/ fatal error | ||
--INI-- | ||
fatal_error_backtraces=On | ||
--FILE-- | ||
<?php | ||
|
||
function trigger_fatal_error_with_stacktrace() { | ||
eval("class Foo {}; class Foo {}"); | ||
} | ||
|
||
register_shutdown_function(function() { | ||
var_dump(error_get_last()); | ||
echo "Done\n"; | ||
}); | ||
|
||
trigger_fatal_error_with_stacktrace(); | ||
?> | ||
--EXPECTF-- | ||
Fatal error: Cannot redeclare class Foo (%s) in %s on line %d | ||
Stack trace: | ||
#0 %serror_get_last_002.php(%d): eval() | ||
#1 %serror_get_last_002.php(%d): trigger_fatal_error_with_stacktrace() | ||
#2 {main} | ||
array(5) { | ||
["type"]=> | ||
int(64) | ||
["message"]=> | ||
string(%d) "Cannot redeclare class Foo %s" | ||
["file"]=> | ||
string(%d) "%serror_get_last_002.php(%d) : eval()'d code" | ||
["line"]=> | ||
int(%d) | ||
["trace"]=> | ||
array(2) { | ||
[0]=> | ||
array(3) { | ||
["file"]=> | ||
string(%d) "%serror_get_last_002.php" | ||
["line"]=> | ||
int(%d) | ||
["function"]=> | ||
string(%d) "eval" | ||
} | ||
[1]=> | ||
array(4) { | ||
["file"]=> | ||
string(%d) "%serror_get_last_002.php" | ||
["line"]=> | ||
int(%d) | ||
["function"]=> | ||
string(%d) "trigger_fatal_error_with_stacktrace" | ||
["args"]=> | ||
array(0) { | ||
} | ||
} | ||
} | ||
} | ||
Done |
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