#48938 [Bgs]: Feels like .*? and /s is problematic, no output generated!

2009-07-16 Thread alexis at m2osw dot com
 ID:   48938
 User updated by:  alexis at m2osw dot com
 Reported By:  alexis at m2osw dot com
 Status:   Bogus
 Bug Type: PCRE related
 Operating System: Linux
 PHP Version:  5.2.10
 New Comment:

Okay, I see an error 2.

I got it to crash yesterday too. Interested? Anyway, I guess that's the
same idea of a too complex regex.

Thank you for replying.


Previous Comments:


[2009-07-16 07:10:34] scott...@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Check out preg_last_error(), you've reached a limit we set in PCRE to
prevent segfaults due to inefficient regular expressions.



[2009-07-16 04:50:14] alexis at m2osw dot com

Description:

I have a pregex that starts looks like this:

/(?:p.*?)?\[.../s

(The last ... is to be interpreted as an ellipsis)

Removing the /s or the p tag before the \[ fixes the problem.
Otherwise the preg_replace_callback() returns an empty string and never
calls the callback. This is the case with several pages of data we have,
although it is not easy for me to determine what triggers the problem.

P.S. If the callback does not exist, the function has a shortcut and
the input is immediately returned as is.

Reproduce code:
---
1740 lines of code found as an attachment to that page:

http://linux.m2osw.com/pcre_php_s_modifier_bug

The main reason for the length is the HTML code, the failing code is
just 1 line at the bottom.


Expected result:

($s == preg_replace_callback(...)) === TRUE

since the callback should not be called with that HTML.

Actual result:
--
preg_replace_callback() returns NULL





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



#48938 [NEW]: Feels like .*? and /s is problematic, no output generated!

2009-07-15 Thread alexis at m2osw dot com
From: alexis at m2osw dot com
Operating system: Linux
PHP version:  5.2.10
PHP Bug Type: PCRE related
Bug description:  Feels like .*? and /s is problematic, no output generated!

Description:

I have a pregex that starts looks like this:

/(?:p.*?)?\[.../s

(The last ... is to be interpreted as an ellipsis)

Removing the /s or the p tag before the \[ fixes the problem. Otherwise
the preg_replace_callback() returns an empty string and never calls the
callback. This is the case with several pages of data we have, although it
is not easy for me to determine what triggers the problem.

P.S. If the callback does not exist, the function has a shortcut and the
input is immediately returned as is.

Reproduce code:
---
1740 lines of code found as an attachment to that page:

http://linux.m2osw.com/pcre_php_s_modifier_bug

The main reason for the length is the HTML code, the failing code is just
1 line at the bottom.


Expected result:

($s == preg_replace_callback(...)) === TRUE

since the callback should not be called with that HTML.

Actual result:
--
preg_replace_callback() returns NULL

-- 
Edit bug report at http://bugs.php.net/?id=48938edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48938r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48938r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48938r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48938r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48938r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48938r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=48938r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=48938r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=48938r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=48938r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=48938r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=48938r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=48938r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48938r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=48938r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=48938r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=48938r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=48938r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=48938r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=48938r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=48938r=mysqlcfg