|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50618 php crashed when preg_replace on some case.
Submitted: 2009-12-31 06:11 UTC Modified: 2010-04-25 20:34 UTC
From: sarun37823 at bigfoot dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.12 OS: Linux
Private report: No CVE-ID: None
 [2009-12-31 06:11 UTC] sarun37823 at bigfoot dot com
I use preg_replace It work fine for most subject(data)
except one.

Reproduce code:
$page_c=implode('', file(''));
//download test file at
$page_c=preg_replace('/<li[^<>]*>(?:.(?!made an edit|<\/?li))*.made[^<>]*<\/div><\/li>/sim', '', $page_c);

Expected result:
blank page

Actual result:
Error: Zero Sized Reply


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-31 07:17 UTC] sarun37823 at bigfoot dot com
if there's no <li></li> in test file
or i just replace <li></li> with <li><!--something--></li>
It can work properly.
 [2009-12-31 07:43 UTC] sarun37823 at bigfoot dot com
I think it's about * in (?:.(?!made an edit|<\/?li))*
Main Idea of this regular expression is to replace
<li> to </li> with no li tag inside and with "made an
edit" string
 [2009-12-31 07:51 UTC] sarun37823 at bigfoot dot com
I just test code above with php 5.2.5 on WinXP
It's work fine.
 [2009-12-31 12:42 UTC]
Does it work on windowns and not on linux?
 [2010-01-08 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-25 20:34 UTC]
-Status: No Feedback +Status: Bogus
 [2010-04-25 20:34 UTC]
Not a PHP bug.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue May 17 08:05:45 2022 UTC