-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use Error exceptions instead of warning in some place in string stdlib #4554
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
Conversation
f5a8027
to
1084c4e
Compare
Please use |
ext/standard/string.c
Outdated
php_error_docref(NULL, E_WARNING, "Empty needle"); | ||
RETURN_FALSE; | ||
zend_throw_exception(zend_ce_error_exception, "Empty needle", E_ERROR); | ||
return; |
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.
I think we might be better off removing these errors entirely instead. There is nothing semantically wrong with an empty needle (it'll always match at the first position). It would remove an unnecessary special case.
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.
Working on it the various implementation of str*pos function family make it a bit awkward to do it in this PR (maybe?). So I will probably do this change separately and try to clean up a bit the implementations.
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.
Yeah, it would be best to do this in a separate PR.
Closing this in favor of the split-off PRs. |
Converted some Warnings to ErrorExceptions, wasn't sure if some of them can/should be converted so I've annotated them.
At the same time split some of the large tests into a variation test for binary tests.