php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36153 preg_match parse errors with correct expressions
Submitted: 2006-01-25 10:04 UTC Modified: 2006-01-25 10:10 UTC
From: a dot steponavicius at gmail dot com Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 4.4.2 OS: Windows XP
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: a dot steponavicius at gmail dot com
New email:
PHP Version: OS:

 

 [2006-01-25 10:04 UTC] a dot steponavicius at gmail dot com
Description:
------------
preg_match returns errors while parsing some correct expressions, o dies with apache if there is more such "errors"...

The same behaviour is both in 4.4.2 and 5.1.2

Reproduce code:
---------------
$expressions = array(
1 => '/^ (?: . ){0,6} $/ix',
2 => '/^ (?: . ){0, 6} $/ix',
3 => '/^ (?: . ) {0, 6} $/ix',
4 => '/^ (?: . ) {0,6} $/ix',
);

foreach ($expressions as $key => $exp) {
    echo $key, ": ";
    var_dump(preg_match($exp, '2', $pat));
    var_dump($pat);
    echo "\n";
}


Expected result:
----------------
1: int(1)
array(1) {
  [0]=>
  string(1) "2"
}

2: int(1)
array(1) {
  [0]=>
  string(1) "2"
}

3: int(1)
array(1) {
  [0]=>
  string(1) "2"
}

4: int(1)
array(1) {
  [0]=>
  string(1) "2"
}


Actual result:
--------------
1: int(1)
array(1) {
  [0]=>
  string(1) "2"
}

2: int(0)
array(0) {
}

3: int(0)
array(0) {
}

4: Warning: preg_match(): Compilation failed: internal error: code overflow at offs
et 17 in D:\Inetpub\Projects\.php5\testrx.php on line 12
bool(false)
array(0) {
}
... or sometimes there is no 4: ... and apache dies...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-25 10:10 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 11:01:30 2024 UTC