From:             dave at smartboy dot com
Operating system: Windows XP
PHP version:      5.1.4
PHP Bug Type:     PCRE related
Bug description:  preg_match fails if strlen >= 1630

Description:
------------
preg_match() with regexp to test for valid UTF-8 sequence - fails and
causes the error message:

'Could not open input file: <name of script>.php'

IF the subject string passed to preg_match() is longer than 1629
characters.  (Or in this case the size of the file 'zzz' which contains
ASCII)

There was no such limitation in preg_match() in the previous version of
PHP (5.1.2)



Reproduce code:
---------------
$str = file_get_contents('zzz');
echo "Loaded file...\n";
$result =
preg_match('/^([\x00-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|'
.
                
'[\xe1-\xec][\x80-\xbf]{2}|\xed[\x80-\x9f][\x80-\xbf]|[\xee-\xef][\x80-\xbf]{2}|'
.
                
'\xf0[\x90-\xbf][\x80-\xbf]{2}|[\xf1-\xf3][\x80-\xbf]{3}|\xf4[\x80-\x8f][\x80-\xbf]{2})*$/S',
                $str) === 1;

echo "Back from preg_match()\n";
var_export($result);
echo "\n";


Expected result:
----------------
Loaded file...
Back from preg_match()
true


Actual result:
--------------
Loaded file...
Could not open input file: u8.php


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

Reply via email to