From: d_kelsey at uk dot ibm dot com Operating system: Windows XP PHP version: 5.2.6 PHP Bug Type: mbstring related Bug description: 2 similar warning messages on mb_strpos and mb_stripos
Description: ------------ 2 warnings are generated when passed an unknown encoding, but one would suffice.The case sensitive versions only produce one. Suggested code change in php_mb_stripos function Move the following code to just below the "do {" line haystack.no_encoding = needle.no_encoding = mbfl_name2no_encoding(from_encoding); if (haystack.no_encoding == mbfl_no_encoding_invalid) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown encoding \"%s\"", from_encoding); break; } Reproduce code: --------------- <?php var_dump(mb_strripos("abc abc abc", "b", 0, "invalid")); var_dump(mb_stripos("abc abc abc", "b", 0, "invalid")); ?> Expected result: ---------------- Warning: mb_strripos(): Unknown encoding "invalid" in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 2 bool(false) Warning: mb_stripos(): Unknown encoding "invalid" in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 3 bool(false) Actual result: -------------- Warning: mb_strripos(): Illegal character encoding specified in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 2 Warning: mb_strripos(): Unknown encoding "invalid" in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 2 bool(false) Warning: mb_stripos(): Illegal character encoding specified in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 3 Warning: mb_stripos(): Unknown encoding "invalid" in C:\udata-eclipse\p8\a.phpcode\testmb.php on line 3 bool(false) -- Edit bug report at http://bugs.php.net/?id=45924&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45924&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45924&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45924&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45924&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45924&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45924&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45924&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45924&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45924&r=support Expected behavior: http://bugs.php.net/fix.php?id=45924&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45924&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45924&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45924&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45924&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45924&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45924&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45924&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45924&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45924&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45924&r=mysqlcfg