#38728 [Opn->Bgs]: preg_replace in UTF-mode memory leak
| From: | tony2001@php.net | Date: | Wed, 06 Sep 2006 13:45:22 +0000 |
| Subject: | #38728 [Opn->Bgs]: preg_replace in UTF-mode memory leak | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-101808@lists.php.net to get a copy of this message | ||
ID: 38728
Updated by: tony2001@php.net
Reported By: doktor at farlep dot net
-Status: Open
+Status: Bogus
Bug Type: *Regular Expressions
Operating System: Linux Slackware 9.1.0
PHP Version: 4.4.4
New Comment:
We can't fix something we're unable to reproduce.
Please provide a short reproduce case. Until then -> bogus.
Previous Comments:
------------------------------------------------------------------------
[2006-09-06 13:41:55] doktor at farlep dot net
I am sorry, but I don't write or attach script, beacose this code from
forum phpBB (file includes/bbcode.php). This forum has very much lines
of code ;)
I am only change property \w on \pL\Sm in 6 functions in this file and
apache server memory leak. If I change properties back on \w and
restart apache - all work fine.
I'm talk with phpBB-developers and they says what this bug in php and
recommended usage function mb_eregi_replace() instead of
preg_replace()
ps: sorry for my bad english :(
------------------------------------------------------------------------
[2006-09-06 08:38:30] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2006-09-05 21:41:20] doktor at farlep dot net
Description:
------------
usage unicode character properties \pL and \Sm in function preg_replace
give apache memory leak. (apache compilled with libphp4.a)
linux load average up to 98
Reproduce code:
---------------
$patterns[] =
"#\[url=([\pL]+?://[(\pL\Sm\#$%&~/.\-;:=,?@\[\]+]*?)\]([^?\n\r\t].*?)\[/url\]#is";
$replacements[] = $bbcode_tpl['url3'];
$text = preg_replace($patterns, $replacements, $text);
Expected result:
----------------
replacing unicode characters in bbcode ( work fine with \w property,
but in utf mode with values greater than 128 never match)
Actual result:
--------------
memory leak
load average: 98.3
fixed - not usage \pL and \Sm in preg_replace and restarting apache
server
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38728&edit=1