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

From: Date: Wed, 30 Dec 2015 18:29:31 +0000
Subject: Bug #71246 [Opn->Nab]: preg_replace failed with too long string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198318@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71246&edit=1 ID: 71246 Updated by: requinix@php.net 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

« previous php.bugs (#198318) next »