From:             
Operating system: Ubuntu 10.10
PHP version:      5.3.3
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:preg_replace_callback doesn't work with the "*?" (lazy 
quantification)

Description:
------------
See the script below, if the $data is too big, then the script will be
failed, but if the regular expression from:

<pre>

!<script>([\s\S]*?)</script>!i

</pre>



changed to 



</pre>

!<script>([\s\S]*)</script>!i

<pre>



Then, it works.



Test script:
---------------
<?php

$data = 'blabla <script>' . str_repeat("a", 1024 * 100) . '</script>';

$data = preg_replace_callback('!<script>([\s\S]*?)</script>!i',
function($matches) {

    return $matches[1];

}, $data);

echo strlen($data);

?>

Expected result:
----------------
102407

Actual result:
--------------
0

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

Reply via email to