From: rich dot sapporo at gmail dot com
Operating system: Mac OS X 10.5.2
PHP version: 5.2.5
PHP Bug Type: Regexps related
Bug description: Inconsistent behaviour by same type of regex
Description:
------------
Min/max quantifiers '{}' in preg_match() don't seem to match more than
765 characters.
Reproduce code:
---------------
// $matches[1] contains the first 765 characters of the string $sample:
preg_match("/^(.{765}).*/", $sample, $matches);
// doesn't match anything:
preg_match("/^(.{766}).*/", $sample, $matches);
// Values from {0} to {765} appear to work fine. 766 onwards, nothing
gets matched.
Expected result:
----------------
I expect the same type of behaviour to happen in both cases.
I realize that preg_match() isn't really necessary to match the first x
characters in a string, but this problem was affecting a more complex
regex I was doing. The "matching the first x chars" example was trying
to isolate where the problem was occurring.
--
Edit bug report at http://bugs.php.net/?id=44623&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44623&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44623&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44623&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44623&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44623&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44623&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44623&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44623&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44623&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44623&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44623&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44623&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44623&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44623&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44623&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44623&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44623&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44623&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44623&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44623&r=mysqlcfg