php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sarun37823 at bigfoot dot com
New email:
PHP Version: OS:

 

 [2009-12-31 06:11 UTC] sarun37823 at bigfoot dot com
Description:
------------
I use preg_replace It work fine for most subject(data)
except one.

Reproduce code:
---------------
<?php
$page_c=implode('', file('phpbug1.data'));
//download test file at
//http://www.greatduo.da.ru/files/phpbug1.data
$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

Patches

Pull Requests

History

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
Add:
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] pajoye@php.net
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] felipe@php.net
-Status: No Feedback +Status: Bogus
 [2010-04-25 20:34 UTC] felipe@php.net
Not a PHP bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC