php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45828 preg_match_all result not correct
Submitted: 2008-08-15 03:47 UTC Modified: 2008-08-15 08:29 UTC
From: chenjii at gmail dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.6 OS: windows xp SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: chenjii at gmail dot com
New email:
PHP Version: OS:

 

 [2008-08-15 03:47 UTC] chenjii at gmail dot com
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 ( ) )

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-15 07:25 UTC] chenjii at gmail dot com
Oh , Date is 2008-08-15 not 2008-05-15
 [2008-08-15 08:29 UTC] nlopess@php.net
Well if it was an OS update that broke PHP, we can't do much about it..
I tested in Windows Vista SP1 and Windows XP SP3 and your test case works, so there's something wrong on your end. (but don't ask me what.. :) I would advise you to reinstall PHP and then reboot the pc.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC