|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-11-09 16:03 UTC] baco at infomaniak dot ch
Description: ------------ eregi() produce random errors like "function.mb-eregi: mbregex compile err: premature end of regular expression in" when used with special chars like accents. N.B. On the web you can found a lot of reports of this issue. Some post suggests forcing mbstring.func_overload = 0 but it doesn't work for me. If Apache1 is restarted the error doesn't come anymore before an amount of time and request. $ GET http://localhost/test.php ok $ GET http://localhost/test.php ok $ GET http://localhost/test.php <br /> <b>Warning</b>: mb_eregi() [<a href='function.mb-eregi'>function.mb-eregi</a>]: mbregex compile err: premature end of regular expression in <b>/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php</b> on line <b>2</b><br /> $ GET http://localhost/test.php <br /> <b>Warning</b>: mb_eregi() [<a href='function.mb-eregi'>function.mb-eregi</a>]: mbregex compile err: premature end of regular expression in <b>/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php</b> on line <b>2</b><br /> $ GET http://localhost/test.php <br /> <b>Warning</b>: mb_eregi() [<a href='function.mb-eregi'>function.mb-eregi</a>]: mbregex compile err: premature end of regular expression in <b>/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php</b> on line <b>2</b><br /> $ GET http://localhost/test.php ok $ GET http://localhost/test.php ok ... Reproduce code: --------------- <?php if (eregi("cit?", "electricit?")) { echo "ok\n"; } ?> Expected result: ---------------- OK Actual result: -------------- <br /> <b>Warning</b>: mb_eregi() [<a href='function.mb-eregi'>function.mb-eregi</a>]: mbregex compile err: premature end of regular expression in <b>/home/www/ca8b72beb934995c1afb34e1a3ceb893/web/test.php</b> on line <b>2</b><br /> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 19:00:01 2025 UTC |
As workaround try to force mbstring.func_overload = 0 in your php.ini and use this patch. PHP5 unix_mbstring_func_overload.patch --- ext/mbstring/mbstring.c 2007-09-24 13:51:36.000000000 +0200 +++ ext/mbstring/mbstring.c 2007-12-04 18:00:10.023564681 +0100 @@ -765,8 +765,8 @@ PHP_INI_ENTRY("mbstring.script_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_script_encoding) #endif /* ZEND_MULTIBYTE */ PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) - STD_PHP_INI_ENTRY("mbstring.func_overload", "0", PHP_INI_SYSTEM | - PHP_INI_PERDIR, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals) + STD_PHP_INI_ENTRY("mbstring.func_overload", "0", + PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals) STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0", PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdate_mbstring_encoding_translation, PHP4 --- ext/mbstring/mbstring.c 2007-04-04 17:28:18.000000000 +0200 +++ ext/mbstring/mbstring.c 2007-12-04 18:05:29.363559316 +0100 @@ -815,8 +815,8 @@ PHP_INI_ENTRY("mbstring.script_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_script_encoding) #endif /* ZEND_MULTIBYTE */ PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) - STD_PHP_INI_ENTRY("mbstring.func_overload", "0", PHP_INI_SYSTEM | - PHP_INI_PERDIR, OnUpdateInt, func_overload, zend_mbstring_globals, mbstring_globals) + STD_PHP_INI_ENTRY("mbstring.func_overload", "0", + PHP_INI_SYSTEM, OnUpdateInt, func_overload, zend_mbstring_globals, mbstring_globals) STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0", PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdate_mbstring_encoding_translation,