summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--ext/spl/spl_iterators.c5
-rw-r--r--ext/spl/tests/bug70868.phpt (renamed from Zend/tests/bug70868.phpt)0
3 files changed, 6 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index b19123201a..0985ae6dda 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ PHP NEWS
test suite). (Anatol)
- SPL:
+ . Fixed bug #70868 (PCRE JIT and pattern reuse segfault). (Laruence)
. Fixed bug #70853 (SplFixedArray throws exception when using ref variable
as index). (Laruence)
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index cd0c624b50..b29fc5298b 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -2059,6 +2059,11 @@ SPL_METHOD(RegexIterator, accept)
{
case REGIT_MODE_MAX: /* won't happen but makes compiler happy */
case REGIT_MODE_MATCH:
+#ifdef PCRE_EXTRA_MARK
+ if (intern->u.regex.pce->extra) {
+ intern->u.regex.pce->extra->flags &= ~PCRE_EXTRA_MARK;
+ }
+#endif
count = pcre_exec(intern->u.regex.pce->re, intern->u.regex.pce->extra, ZSTR_VAL(subject), ZSTR_LEN(subject), 0, 0, NULL, 0);
RETVAL_BOOL(count >= 0);
break;
diff --git a/Zend/tests/bug70868.phpt b/ext/spl/tests/bug70868.phpt
index d3dd76354a..d3dd76354a 100644
--- a/Zend/tests/bug70868.phpt
+++ b/ext/spl/tests/bug70868.phpt