From:             jana dot vasseru at gmail dot com
Operating system: W2000
PHP version:      5.2.4
PHP Bug Type:     *Regular Expressions
Bug description:  reg_replace returns empty string on certain data

Description:
------------
On certain data preg_replace() returns empty string. The code below works
correctly on PHP 5.1.6

Reproduce code:
---------------
<?php

$data = file_get_contents('src.sql');
echo strlen($data).'<br>';
$data = preg_replace("#INSERT\\sINTO([\\s\\S]*?)INSERT\\sINTO#",
"\$DELTA_SCRIPT[] = 'INSERT INTO\\1'; \$DELTA_SCRIPT[] = 'INSERT INTO",
$data);
$data = preg_replace("#CREATE\\sTABLE([\\s\\S]*?)[^']INSERT\\sINTO#",
"CREATE TABLE \\1 \$DELTA_SCRIPT[] = 'INSERT INTO", $data);
echo strlen($data); //returns 0 here

?>

Expected result:
----------------
Return whatever but empty string.

Actual result:
--------------
Returns empty string.

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

Reply via email to