diff options
author | Nicolas Grekas <nicolas.grekas@gmail.com> | 2017-05-16 12:46:32 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2017-05-29 11:40:29 +0200 |
commit | 3c43510b19a94c41d3c2a724664fcd1aa9f63d14 (patch) | |
tree | 3064c58f6c33ce660aad8b73f5153bb3badcce2a /ext/pcre/tests/bug61780_2.phpt | |
parent | 0f20970216df909ac0e46a55398decc5270643d4 (diff) | |
download | php-git-3c43510b19a94c41d3c2a724664fcd1aa9f63d14.tar.gz |
add PREG_UNMATCHED_AS_NULL flag to allow distinguish between unmatched subpatterns and empty matches
Diffstat (limited to 'ext/pcre/tests/bug61780_2.phpt')
-rw-r--r-- | ext/pcre/tests/bug61780_2.phpt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/pcre/tests/bug61780_2.phpt b/ext/pcre/tests/bug61780_2.phpt index 375c02f5d2..faf44d368b 100644 --- a/ext/pcre/tests/bug61780_2.phpt +++ b/ext/pcre/tests/bug61780_2.phpt @@ -2,22 +2,22 @@ Bug #61780 (Inconsistent PCRE captures in match results): named subpatterns --FILE-- <?php -preg_match('/(?<a>4)?(?<b>2)?\d/', '23456', $matches); +preg_match('/(?<a>4)?(?<b>2)?\d/', '23456', $matches, PREG_UNMATCHED_AS_NULL); var_export($matches); echo "\n\n"; -preg_match('/(?<a>4)?(?<b>2)?\d/', '23456', $matches, PREG_OFFSET_CAPTURE); +preg_match('/(?<a>4)?(?<b>2)?\d/', '23456', $matches, PREG_OFFSET_CAPTURE | PREG_UNMATCHED_AS_NULL); var_export($matches); echo "\n\n"; -preg_match_all('/(?<a>4)?(?<b>2)?\d/', '123456', $matches); +preg_match_all('/(?<a>4)?(?<b>2)?\d/', '123456', $matches, PREG_UNMATCHED_AS_NULL); var_export($matches); echo "\n\n"; -preg_match_all('/(?<a>4)?(?<b>2)?\d/', '123456', $matches, PREG_OFFSET_CAPTURE); +preg_match_all('/(?<a>4)?(?<b>2)?\d/', '123456', $matches, PREG_OFFSET_CAPTURE | PREG_UNMATCHED_AS_NULL); var_export($matches); echo "\n\n"; -preg_match_all('/(?<a>4)?(?<b>2)?\d/', '123456', $matches, PREG_SET_ORDER); +preg_match_all('/(?<a>4)?(?<b>2)?\d/', '123456', $matches, PREG_SET_ORDER | PREG_UNMATCHED_AS_NULL); var_export($matches); echo "\n\n"; -preg_match_all('/(?<a>4)?(?<b>2)?\d/', '123456', $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); +preg_match_all('/(?<a>4)?(?<b>2)?\d/', '123456', $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE | PREG_UNMATCHED_AS_NULL); var_export($matches); ?> --EXPECT-- |