Skip to content

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

Closed

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Aug 17, 2019

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.

@Girgias Girgias force-pushed the convert-warnings-to-error-exceptions branch from f5a8027 to 1084c4e Compare August 17, 2019 14:42
@nikic
Copy link
Member

nikic commented Aug 17, 2019

Please use Error instead (zend_throw_error).

php_error_docref(NULL, E_WARNING, "Empty needle");
RETURN_FALSE;
zend_throw_exception(zend_ce_error_exception, "Empty needle", E_ERROR);
return;
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

@nikic
Copy link
Member

nikic commented Aug 23, 2019

Closing this in favor of the split-off PRs.

@nikic nikic closed this Aug 23, 2019
@Girgias Girgias deleted the convert-warnings-to-error-exceptions branch November 20, 2019 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants