Bug #77923 [Opn->Nab]: preg_* function cannot get correct result
| From: | requinix@php.net | Date: | Sat, 20 Apr 2019 05:52:07 +0000 |
| Subject: | Bug #77923 [Opn->Nab]: preg_* function cannot get correct result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220531@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77923&edit=1
ID: 77923
Updated by: requinix@php.net
Reported by: 2317216477 at qq dot com
Summary: preg_* function cannot get correct result
-Status: Open
+Status: Not a bug
Type: Bug
Package: PCRE related
Operating System: any
PHP Version: 7.2.18RC1
Block user comment: N
Private report: N
New Comment:
Your regular expression is too inefficient to be used with JIT mode on such a large input. PCRE (not
PHP) is aborting executing because it ran out of stack space - preg_last_error() =
PREG_JIT_STACKLIMIT_ERROR (6).
Disabling JIT for that regex is a workaround. Fixing the regex is better.
But personally I would consider using SimpleXML to find the <w:p> elements, scan for your
${var} or ${/var} tokens, then... I don't know what you want to do from there.
Previous Comments:
------------------------------------------------------------------------
[2019-04-19 11:33:48] 2317216477 at qq dot com
You can use "ini_set" and set "pcre.jit" to 0 before preg_* functions to fix the
problem
I don't know why it happens and hope someone can fix it basically
------------------------------------------------------------------------
[2019-04-19 11:23:20] 2317216477 at qq dot com
Description:
------------
preg_* function cannot get correct result in php7.0~7.2 sometimes
the test string is too long so I put a test script on my github
page(https://github.com/icy2003/php/blob/master/samples/php7preg_bug.php)
you can test this script on this website:https://3v4l.org/,or you
can install php 7.0~7.2 in local environment
Test script:
---------------
https://github.com/icy2003/php/blob/master/samples/php7preg_bug.php
Expected result:
----------------
my pattern expected some results but in php7.0~7.2 it will be empty array!!
you can use "ini_set" and set "pcre.jit" to 0 before preg_* functions to fix the
problem
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77923&edit=1