Bug #71246 [Opn->Nab]: preg_replace failed with too long string

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=71246&edit=1

 ID:                 71246
 Updated by:         [email protected]
 Reported by:        phpbug at lvht dot net
 Summary:            preg_replace failed with too long string
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            *Regular Expressions
 Operating System:   mac, ubuntu 14.04
 PHP Version:        7.0.1
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Your regex is not efficient enough to handle a string of that length. It needs to be optimized, such as by removing parentheses or using greedy quantifiers or using once-only subpatterns.


Previous Comments:
------------------------------------------------------------------------
[2015-12-30 15:37:30] phpbug at lvht dot net

Description:
------------
preg_replace anainst big string failed and preg_last_error() returns PREG_JIT_STACKLIMIT_ERROR

Test script:
---------------
<?php
$value = '{{--' . str_repeat('_', 1024). '--}}';

$pattern = '/{{--((.|\s)*?)--}}/';

var_dump(preg_replace($pattern, '+', $value));

Expected result:
----------------
+

Actual result:
--------------
NULL




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71246&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.