#38600 [Opn->Fbk]: Infinite loop in preg_match

From: Date: Fri, 25 Aug 2006 21:39:04 +0000
Subject: #38600 [Opn->Fbk]: Infinite loop in preg_match
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-101354@lists.php.net to get a copy of this message
 ID:               38600
 Updated by:       tony2001@php.net
 Reported By:      phillip dot berndt at googlemail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         PCRE related
 Operating System: Linux
 PHP Version:      5.1.5
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip




Previous Comments:
------------------------------------------------------------------------

[2006-08-25 21:14:47] phillip dot berndt at googlemail dot com

Description:
------------
When executing the code below, the function won't return but loop
forever (or do something else, I don't know).

Reproduce code:
---------------
<?php
        $foo = 'bla bla bla';
       
preg_match('/(?<!\w)(0x[\p{N}]+[lL]?|[\p{Nd}]+(e[\p{Nd}]*)?[lLdDfF]?)(?!\w)/',
$foo);
?>

Expected result:
----------------
Something like that:

pberndt@locutus ~ $ time perl -e '$_="bla bla bla";
/(?<!\w)(0x[\p{N}]+[lL]?|[\p{Nd}]+(e[\p{Nd}]*)?[lLdDfF]?)(?!\w)/;'

real    0m0.017s
user    0m0.016s
sys     0m0.000s


Actual result:
--------------
pberndt@locutus ~ $ php
<?php
        set_time_limit(10);
        $foo = 'bla bla bla';
       
preg_match('/(?<!\w)(0x[\p{N}]+[lL]?|[\p{Nd}]+(e[\p{Nd}]*)?[lLdDfF]?)(?!\w)/',
$foo);
?>


Fatal error: Maximum execution time of 10 seconds exceeded in
/home/pberndt/- on line 4



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38600&edit=1



Thread (7 messages)

« previous php.bugs (#101354) next »