-
Notifications
You must be signed in to change notification settings - Fork 510
Implement PregGrepDynamicReturnTypeExtension #2560
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
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
31d96db
to
81f2ed3
Compare
This pull request has been marked as ready for review. |
@staabm Hi! 👋 In addition to an invalid regular expression returning Is this worth worrying about? (I would suspect not, but I thought I'd ask!) |
Hi. Thanks for the feedback. Do you think these are situations we can detect? Could you provide a reproducing example? We may use a benevolent union to allow handling of false, without errors. |
Hi, No, based on the cursory glance I gave php-src & pcre, I don't think these would be detectable. They're more of an edge case run time thing. 99.99% of Probably outside the scope of this PR, but could other |
I don't think from a userland perspective "out-of-memory" errors can be handled.
if you have a example please create a separate issue. AFAIR is this already the case for some |
3892dad
to
a364d02
Compare
Per discussion in php/php-src#11927 (comment) it seems memory errors of the underlying regex libraries are not something which can be handled in php userland in a useful way. Therefore I think this is good to go |
did a bit more research. I think we can do the same for https://phpstan.org/r/a538ad90-be19-4c67-a5ed-fbc573d4f888
|
d4c52c7
to
9f42601
Compare
I looked thru the failling extension tests and think the new errors are valid/need to be baselined |
There are too many errors in the integration test suite, I kind of doubt all of them are fault of the analysed code. I'm not a regexp expert. But I'd say the |
@Seldaek since you built a preg_* wrapping lib for composer, may I ask whether you are aware of a case where the preg-functions can return in other words: are you aware of a case where it makes sense to handle a the only valid case I could think of was a out-of-memory error in PCRE, but a php-src dev told me that php-src would also likely run out of memory in this case, because they share the same allocator |
hmm I think I found a case https://3v4l.org/0vAeY |
Yeah it can also fail due to the backtracking limit (this is from a test we have in composer/pcre) https://3v4l.org/M2cZeV and that is purely dependent on the subject. |
main driver is eleminating a
false
return type, when a constant regex pattern is validhttps://www.php.net/manual/en/function.preg-grep.php
failling tests before PR: https://phpstan.org/r/cf5bed2b-490f-4769-af9e-611f28950c50