-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RFC] Make string length for getTraceAsString() configurable
Add a `zend.exception_string_param_max_len` ini setting. (same suffix as `log_errors_max_len`) Allow values between 0 and 1000000 bytes. For example, with zend.exception_string_param_max_len=0, "" would represent the empty string, and "..." would represent something longer than the empty string. Previously, this was hardcoded as exactly 15 bytes. Discussion: https://externals.io/message/110717 Closes GH-5769
- Loading branch information
1 parent
8664ff7
commit 07db641
Showing
9 changed files
with
108 additions
and
4 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,19 @@ | ||
--TEST-- | ||
zend.exception_string_param_max_len ini setting | ||
--INI-- | ||
zend.exception_string_param_max_len = 23 | ||
--FILE-- | ||
<?php | ||
|
||
function main($arg) { | ||
throw new Exception(); | ||
} | ||
main('123456789012345678901234567890'); | ||
|
||
?> | ||
--EXPECTF-- | ||
Fatal error: Uncaught Exception in %s:%d | ||
Stack trace: | ||
#0 %s(%d): main('12345678901234567890123...') | ||
#1 {main} | ||
thrown in %s on line %d |
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,41 @@ | ||
--TEST-- | ||
zend.exception_string_param_max_len ini setting | ||
--FILE-- | ||
<?php | ||
|
||
function main($arg) { | ||
echo (new Exception()), "\n"; | ||
} | ||
var_dump(ini_set('zend.exception_string_param_max_len', '-1')); | ||
var_dump(ini_set('zend.exception_string_param_max_len', '1000001')); | ||
var_dump(ini_set('zend.exception_string_param_max_len', '1000000')); | ||
var_dump(ini_set('zend.exception_string_param_max_len', '20')); | ||
main('short'); | ||
main('123456789012345678901234567890'); | ||
var_dump(ini_set('zend.exception_string_param_max_len', '0')); | ||
main('short'); | ||
main(''); | ||
|
||
?> | ||
--EXPECTF-- | ||
bool(false) | ||
bool(false) | ||
string(2) "15" | ||
string(7) "1000000" | ||
Exception in %s:%d | ||
Stack trace: | ||
#0 %s(10): main('short') | ||
#1 {main} | ||
Exception in %s:%d | ||
Stack trace: | ||
#0 %s(11): main('12345678901234567890...') | ||
#1 {main} | ||
string(2) "20" | ||
Exception in %s:%d | ||
Stack trace: | ||
#0 %s(13): main('...') | ||
#1 {main} | ||
Exception in %s:%d | ||
Stack trace: | ||
#0 %s(14): main('') | ||
#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
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
07db641
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TysonAndre I believe this needs an entry on
UPGRADING
.07db641
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 85d4b56, based off of the UPGRADING entry for 7.4 and zend.exception_ignore_args