Bug #69741 [Fbk->Opn]: preg_replace memory fail
| From: | informatica at ortopediaplus dot com | Date: | Tue, 02 Jun 2015 08:18:08 +0000 |
| Subject: | Bug #69741 [Fbk->Opn]: preg_replace memory fail | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193064@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69741&edit=1
ID: 69741
User updated by: informatica at ortopediaplus dot com
Reported by: informatica at ortopediaplus dot com
Summary: preg_replace memory fail
-Status: Feedback
+Status: Open
Type: Bug
Package: PCRE related
Operating System: Linux 2.6.32-504.8.1.el6.x86_64
PHP Version: 5.6.9
Block user comment: N
Private report: N
New Comment:
With memory fail hasn't pcre.backtrack_limit and pcre.recursion_limit.
If I use pcre.backtrack_limit or pcre.recursion_limit with any value (1, 100, 1000, 10000), then
preg_replace return NULL if match or return $content if not match.
I'm absolutely sure with the string "<!--TAG_END-->".
Previous Comments:
------------------------------------------------------------------------
[2015-06-01 19:52:35] requinix@php.net
What are your pcre.* INI settings? And are you absolutely sure the string does contain
"<!--TAG_END-->"?
------------------------------------------------------------------------
[2015-06-01 16:18:39] informatica at ortopediaplus dot com
Description:
------------
Segmentation fault use preg_replace
Test script:
---------------
$pattern = "/<!--TAG_INI-->(.|\n)*?<!--TAG_END-->/";
There are 100000 characters between <!--TAG_INI--> and <!--TAG_END--> in $content
$content = preg_replace($pattern, 'foo', $content);
SEGMENTATION FAULT!!!
Expected result:
----------------
Replace all text between <!--TAG_INI--> and <!--TAG_END--> to 'foo'
Actual result:
--------------
SEGMENTATION FAULT.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69741&edit=1