Re: BC break in master (7.2) - Distinguish betweenunmatched subpatterns and empty matches in preg_*()
| From: | Christoph M. Becker | Date: | Tue, 16 May 2017 22:03:46 +0000 |
| Subject: | Re: BC break in master (7.2) - Distinguish betweenunmatched subpatterns and empty matches in preg_*() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-99062@lists.php.net to get a copy of this message | ||
On 15.05.2017 at 17:49, Remi Collet:
>> I suggest not to set unmatched subpatterns at all,
>
> Can you give an example of expected output ?
> (I think stable position for matched pattern is important)
>
> php -r 'var_dump(preg_match("/(a)?([a-z]*)(\d*)/", "123", $matches),
> $matches);'
See the pcretest results danielklein posted in his last comment on
<https://bugs.php.net/61780>. Basically, instead of
assigning NULL as
values, the array indexes could be skipped, so that array_key_exists()
can be used to determine whether a certain subpattern matched or not.
--
Christoph M. Becker