-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[RFC] FILTER_THROW_ON_FAILURE #18896
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
base: master
Are you sure you want to change the base?
[RFC] FILTER_THROW_ON_FAILURE #18896
Conversation
8c5abca
to
86969e5
Compare
86969e5
to
10dab9e
Compare
LGTM fwiw. (I don't have access use the actual github review form on php-src, but it lgtm.) |
ext/filter/filter.c
Outdated
zend_throw_exception_ex( | ||
php_filter_failed_exception_ce, | ||
0, | ||
"filter validation failed: filter %s not satisfied by %s", |
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.
Would it make sense to use '
around the %s
's? In the error message, you can now end up with a phrase like:
filter validation failed: filter %s not satisfied by elephpants
Which reads as a joke... as it's unclear whether elephpants
are the variable contents that the filter is operating on.
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.
Done for this one, since the second %s is a string version of the value
zend_throw_exception_ex( | ||
php_filter_failed_exception_ce, | ||
0, | ||
"filter validation failed: not an array (got %s)", |
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.
ditto
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.
Here %s is not just the string value, it can also be "true"/"false"/"null" for true/false/null, or a class name; I think quotes here would be more confusing, and the name is clearly everything after the "got"
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.
maybe
Z_TYPE_P(value) == IS_STRING ?
"filter validation failed: not an array (got '%s')"
: "filter validation failed: not an array (got %s)"
5e658f7
to
e16eb44
Compare
https://wiki.php.net/rfc/filter_throw_on_failure