From:             a dot steponavicius at gmail dot com
Operating system: Windows XP
PHP version:      4.4.2
PHP Bug Type:     *Regular Expressions
Bug description:  preg_match parse errors with correct expressions

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...

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

Reply via email to