-
Notifications
You must be signed in to change notification settings - Fork 8k
Aggressively use actual function parameters in php_verror
#12276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
NattyNarwhal
wants to merge
15
commits into
php:master
Choose a base branch
from
NattyNarwhal:verror-consistent-params
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
967fa4e
Aggressively use actual func params in verror
NattyNarwhal 502acc3
share code path for arg list string building
NattyNarwhal 63b7a4f
Make suggested refactors
NattyNarwhal b83d4d9
Change bless to clean up absolute paths
NattyNarwhal db2184a
Handle file:// URIs too
NattyNarwhal f4a43ea
Make this const to match refactors since rebase
NattyNarwhal a6f5a3b
Gate new error func arg display behind display_error_function_args
NattyNarwhal b4a67d6
Add this to the hardcoded options for test runner
NattyNarwhal e788673
Add test for display_error_function_args
NattyNarwhal 1e981ce
remove goto
NattyNarwhal fdb57ae
Add to the PHP INI templates
NattyNarwhal 7a81b0e
Rename option to error_ignore_args
NattyNarwhal 7840f27
Fix this test since it calls PHP itself
NattyNarwhal 11ddadf
Quick hack to placate Windows OpenSSL tests w/ new INI opt
NattyNarwhal 5e43726
Not a good place for this comment
NattyNarwhal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,28 @@ | ||
| --TEST-- | ||
| Displaying function arguments in errors | ||
| --INI-- | ||
| error_ignore_args=Off | ||
| --FILE-- | ||
| <?php | ||
|
|
||
| // A function that sets its own parameters in docref call, to compare | ||
| unlink('/'); | ||
| // Something with sensitive parameters that exists in a minimal build, | ||
| // and also doesn't set anything in the docref call | ||
| // XXX: May be better to provide a new zend_test func? | ||
| password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0))); | ||
|
|
||
| ini_set("error_ignore_args", "On"); | ||
|
|
||
| unlink('/'); | ||
| password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0))); | ||
|
|
||
| ?> | ||
| --EXPECTF-- | ||
| Warning: unlink('/'): %s in %s on line %d | ||
|
|
||
| Warning: password_hash(Object(SensitiveParameterValue), '2y', Array): The "salt" option has been ignored, since providing a custom salt is no longer supported in %s on line %d | ||
|
|
||
| Warning: unlink(/): %s in %s on line %d | ||
|
|
||
| Warning: password_hash(): The "salt" option has been ignored, since providing a custom salt is no longer supported in %s on line %d |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -64,6 +64,7 @@ | |||||
| #include "win32/php_registry.h" | ||||||
| #include "ext/standard/flock_compat.h" | ||||||
| #endif | ||||||
| #include "Zend/zend_builtin_functions.h" | ||||||
| #include "Zend/zend_exceptions.h" | ||||||
|
|
||||||
| #if PHP_SIGCHILD | ||||||
|
|
@@ -803,6 +804,7 @@ PHP_INI_BEGIN() | |||||
| STD_PHP_INI_ENTRY_EX("display_errors", "1", PHP_INI_ALL, OnUpdateDisplayErrors, display_errors, php_core_globals, core_globals, display_errors_mode) | ||||||
| STD_PHP_INI_BOOLEAN("display_startup_errors", "1", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals) | ||||||
| STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals) | ||||||
| STD_PHP_INI_BOOLEAN("error_ignore_args", "0", PHP_INI_ALL, OnUpdateBool, error_ignore_args, php_core_globals, core_globals) | ||||||
| STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals) | ||||||
| STD_PHP_INI_ENTRY("docref_root", "", PHP_INI_ALL, OnUpdateString, docref_root, php_core_globals, core_globals) | ||||||
| STD_PHP_INI_ENTRY("docref_ext", "", PHP_INI_ALL, OnUpdateString, docref_ext, php_core_globals, core_globals) | ||||||
|
|
@@ -1134,7 +1136,14 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ | |||||
|
|
||||||
| /* if we still have memory then format the origin */ | ||||||
| if (is_function) { | ||||||
| origin_len = spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, params); | ||||||
| zend_string *dynamic_params = NULL; | ||||||
| if (PG(error_ignore_args) == false) { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this condition inverted now?
Suggested change
|
||||||
| dynamic_params = zend_trace_current_function_args_string(); | ||||||
| } | ||||||
| origin_len = spprintf(&origin, 0, "%s%s%s(%s)", class_name, space, function, dynamic_params ? ZSTR_VAL(dynamic_params) : params); | ||||||
| if (dynamic_params) { | ||||||
| zend_string_release(dynamic_params); | ||||||
| } | ||||||
| } else { | ||||||
| origin_len = strlen(function); | ||||||
| origin = estrndup(function, origin_len); | ||||||
|
|
||||||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this expected to emit errors during regular operation? Otherwise I would find it okay to leave out that option here and fix a (small) number of tests.
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.
One test (
sapi/cli/tests/gh18582.phpt) does so. I set it here to make them consistent across all tests in case more are added; if not appropriate, it can be moved to that test with thecmd_argsparameter on the server function.