Skip to content
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

add PREG_UNMATCHED_AS_NULL flag to allow distinguish between unmatched subpatterns and empty matches #2526

Closed
wants to merge 1 commit into from

Conversation

nicolas-grekas
Copy link
Contributor

Makes #1303 opt-in, fixing the BC break it introduced.

@Majkl578
Copy link
Contributor

👍 But the name sounds strange - I originally suggested something like PREG_SUBPATTERN_UNMATCHED_NULL or PREG_UNMATCHED_AS_NULL, how about that?

@sgolemon
Copy link
Contributor

Agree with @Majkl578 on name, and I like PREG_UNMATCHED_AS_NULL (but I don't care enough to bikeshed on it)

I see you've updated (essentially reverted from prior commit) the tests dealing with unmatched subpatterns, but would you mind adding a test which uses the constant?

@Fleshgrinder
Copy link
Contributor

I second PREG_UNMATCHED_AS_NULL and think its very important to get the naming right (always).

@nicolas-grekas
Copy link
Contributor Author

Updated
Tests with the const already exist, see bug61780*.phpt

@nicolas-grekas nicolas-grekas changed the title add PREG_NULL_NONMATCHES flag to allow distinguish between unmatched subpatterns and empty matches add PREG_UNMATCHED_AS_NULL flag to allow distinguish between unmatched subpatterns and empty matches May 16, 2017
@sgolemon
Copy link
Contributor

Oh, weird, dunno how I missed the tests before. Anyway, thumbs up from me.

@nicolas-grekas
Copy link
Contributor Author

Could this be merged please? That'd help us try 7.2 as it removes the BC break. Then if the new part needs improvement, it'll be open to another PR.

@remicollet
Copy link
Contributor

LGTM, will merge it asap

@php-pulls
Copy link

Comment on behalf of remi at php.net:

Merged, thanks

@php-pulls php-pulls closed this May 29, 2017
@nicolas-grekas nicolas-grekas deleted the null_nonmatches branch May 29, 2017 10:55
@nicolas-grekas
Copy link
Contributor Author

ping @cmb69 FYI since you wanted to have another behavior when the flag (another one) is passed.
Thanks @remicollet for merging.

@cmb69
Copy link
Contributor

cmb69 commented May 29, 2017

@nicolas-grekas Thanks for the ping. Since others like this PR, it's okay for me to have this behavior. :)

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.

None yet

8 participants