php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40195 PCRE Version 6.7 04-Jul-06 seems to have a bug
Submitted: 2007-01-22 14:59 UTC Modified: 2007-02-09 19:58 UTC
From: tsasaki99 at yahoo dot co dot jp Assigned: andrei (profile)
Status: Closed Package: PCRE related
PHP Version: 5.2.0 OS: Debian GNU/Linux etch
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
36 - 23 = ?
Subscribe to this entry?

 
 [2007-01-22 14:59 UTC] tsasaki99 at yahoo dot co dot jp
Description:
------------
PCRE (Perl Compatible Regular Expression library) Version 6.7 04-Jul-06 seems to have a bug. This version is included in PHP 5.2 and PHP 6. Consequently preg_match() function in PHP seems to inherit the bug. The main issue is summarized as follows.

    * case1 ^(/([a-z]*))*$ matches //abcde
    * case2 ^(/(?:[a-z]*))*$ doesn't match //abcde
    * case3 ^(/([a-z]*))*$ matches /a/abcde
    * case4 ^(/(?:[a-z]*))*$ matches /a/abcde 

The second regex should match. Not only PHP 5 but also PHP 6 CVS snapshot still includes PCRE version 6.7 04-Jul-06. So, I report the issue.

The complete report and examination results are in
http://geeklog.windy.cx/article.php/20070122224722545

Reproduce code:
---------------
preg_match("@^(/(?:[a-z]*))*$@", "//abcde", &$m);
var_dump($m);

Expected result:
----------------
array(2) {
  [0]=>
  string(7) "//abcde"
  [1]=>
  string(6) "/abcde"
}


Actual result:
--------------
array(0) {
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-22 21:43 UTC] nlopess@php.net
I confirm this is a bug in pcre. so let's ask Andrei to upgrade PCRE to version 7, maybe for PHP 5.2.2 (assign back to me if you want me to do it).
 [2007-02-09 19:58 UTC] nlopess@php.net
bundled pcre upgrade to version 7.0.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 13:01:23 2019 UTC