Bug #69741 [Fbk->NoF]: preg_replace memory fail

From: Date: Sun, 14 Jun 2015 04:22:23 +0000
Subject: Bug #69741 [Fbk->NoF]: preg_replace memory fail
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193444@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 Updated by: php-bugs@lists.php.net Reported by: informatica at ortopediaplus dot com Summary: preg_replace memory fail -Status: Feedback +Status: No Feedback Type: Bug Package: PCRE related Operating System: Linux 2.6.32-504.8.1.el6.x86_64 PHP Version: 5.6.9 Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2015-06-04 09:18:07] requinix@php.net @informatica: . combined with the /s flag is basically the same as what you have now. The big difference is that it doesn't use a capturing group, which will greatly increase performance. Please try what @cmb posted as your problem may just be the result of an inefficient regex. ------------------------------------------------------------------------ [2015-06-04 08:03:52] informatica at ortopediaplus dot com The error persists. In the documentation, for meta-characters: . match any character except newline (by default) My variable $content has newline (\n). Fail with \n "/<!--TAG_INI-->(.|\n)*?<!--TAG_END-->/s" ------------------------------------------------------------------------ [2015-06-04 01:48:44] cmb@php.net See <http://3v4l.org/ICria>. The segfault occurs for PHP 4 and 5, but has been resolved in current master (the upcoming PHP 7). However, I wonder why you don't use the following pattern: "/<!--TAG_INI-->.*?<!--TAG_END-->/s" That seems to be more intuitive, and works fine even with very old PHP versions, see <http://3v4l.org/UUFM6>. Apparently, there has been a bug introduced with PHP 5.2.0 and resolved with PHP 5.3.7, though. ------------------------------------------------------------------------ [2015-06-02 08:18:06] informatica at ortopediaplus dot com 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-->". ------------------------------------------------------------------------ [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-->"? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=69741 -- Edit this bug report at https://bugs.php.net/bug.php?id=69741&edit=1

« previous php.bugs (#193444) next »