From: chenjii at gmail dot com
Operating system: windows xp SP2
PHP version: 5.2.6
PHP Bug Type: PCRE related
Bug description: preg_match_all result not correct
Description:
------------
preg_match_all's result is correct before windows update !
But yesterday (2008-05-15) I update my windows xp by windows's Auto Update
, preg_match_all's result became not correct!
my OS: windows XP SP2 (Traditional Chinese)
php: 5.2.6 in windows
PCRE Library Version 7.6 2008-01-28
Reproduce code:
---------------
$array_matches = array();
$sql = 'SELECT b.* , u.account , u.name , u2.account as account2 , u2.name
as name2 FROM bbss as b LEFT JOIN users as u on (u.uid = b.post_uid) LEFT
JOIN users as u2 on (u2.uid = b.modified_uid) WHERE deleted = 0 AND
view_start_time <= NOW() ORDER BY bid DESC LIMIT 0 , 20';
$match_count = preg_match_all('/^(SELECT.*?)LIMIT/im', $sql,
$array_matches);
Expected result:
----------------
$match_count > 0;
$array_matches ==
Array(
[0] => Array ( 'SELECT b.* , u.account , u.name , u2.account as account2
, u2.name as name2 FROM bbss as b LEFT JOIN users as u on (u.uid =
b.post_uid) LEFT JOIN users as u2 on (u2.uid = b.modified_uid) WHERE
deleted = 0 AND view_start_time <= NOW() ORDER BY bid DESC LIMIT 0 , 20' )
[1] => Array ( 'SELECT b.* , u.account , u.name , u2.account as account2
, u2.name as name2 FROM bbss as b LEFT JOIN users as u on (u.uid =
b.post_uid) LEFT JOIN users as u2 on (u2.uid = b.modified_uid) WHERE
deleted = 0 AND view_start_time <= NOW() ORDER BY bid DESC ' )
)
Actual result:
--------------
$match_count == 0
$array_matches == Array ( [0] => Array ( ) [1] => Array ( ) )
--
Edit bug report at http://bugs.php.net/?id=45828&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45828&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45828&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45828&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45828&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45828&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45828&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45828&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45828&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45828&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45828&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45828&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45828&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45828&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45828&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45828&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45828&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45828&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45828&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45828&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45828&r=mysqlcfg