#43998 [Opn->Asn]: Two error messages returned for incorrect encoding for mb_strto[upper|lower]

From: Date: Thu, 31 Jan 2008 17:04:14 +0000
Subject: #43998 [Opn->Asn]: Two error messages returned for incorrect encoding for mb_strto[upper|lower]
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121832@lists.php.net to get a copy of this message
ID: 43998 Updated by: nicholsr@php.net Reported By: josmessa at uk dot ibm dot com -Status: Open +Status: Assigned Bug Type: mbstring related Operating System: Windows XP SP2 PHP Version: 5.2CVS-2008-01-31 (snap) -Assigned To: +Assigned To: hirokawa New Comment: Assign to extension maintainer Previous Comments: ------------------------------------------------------------------------ [2008-01-31 16:09:24] josmessa at uk dot ibm dot com Description: ------------ When an incorrect or unknown encoding is passed to mb_strto[upper|lower] two error messages are returned which both are warning about the same thing. In some cases, one error message is returned as well as an upper/lowercased string, but this behaviour is not documented. Reproduce code: --------------- <?php $sourcestring = 'Hello, World'; $inputs = array(12345, 12.3456789000E-10, true, false, ""); $iterator = 1; foreach($inputs as $input) { echo "\n-- Iteration $iterator --\n"; var_dump( mb_strtolower($sourcestring, $input) ); var_dump( mb_strtoupper($sourcestring, $input) ); $iterator++; }; ?> Expected result: ---------------- Only one error message should be returned for iterations 1-3 Actual result: -------------- -- Iteration 1 -- Warning: mb_strtolower(): Illegal character encoding specified in ...\mb_strtolower.php on line 8 Warning: mb_strtolower(): Unknown encoding "12345" in ...\mb_strtolower.php on line 8 bool(false) Warning: mb_strtoupper(): Illegal character encoding specified in ...\mb_strtolower.php on line 9 Warning: mb_strtoupper(): Unknown encoding "12345" in ...\mb_strtolower.php on line 9 bool(false) -- Iteration 2 -- Warning: mb_strtolower(): Illegal character encoding specified in ...\mb_strtolower.php on line 8 Warning: mb_strtolower(): Unknown encoding "1.23456789E-9" in ...\mb_strtolower.php on line 8 bool(false) Warning: mb_strtoupper(): Illegal character encoding specified in ...\mb_strtolower.php on line 9 Warning: mb_strtoupper(): Unknown encoding "1.23456789E-9" in ...\mb_strtolower.php on line 9 bool(false) -- Iteration 3 -- Warning: mb_strtolower(): Illegal character encoding specified in ...\mb_strtolower.php on line 8 Warning: mb_strtolower(): Unknown encoding "1" in ...\mb_strtolower.php on line 8 bool(false) Warning: mb_strtoupper(): Illegal character encoding specified in ...\mb_strtolower.php on line 9 Warning: mb_strtoupper(): Unknown encoding "1" in ...\mb_strtolower.php on line 9 bool(false) -- Iteration 4 -- Warning: mb_strtolower(): Illegal character encoding specified in ...\mb_strtolower.php on line 8 string(12) "hello, world" Warning: mb_strtoupper(): Illegal character encoding specified in ...\mb_strtolower.php on line 9 string(12) "HELLO, WORLD" -- Iteration 5 -- Warning: mb_strtolower(): Illegal character encoding specified in ...\mb_strtolower.php on line 8 string(12) "hello, world" Warning: mb_strtoupper(): Illegal character encoding specified in ...\mb_strtolower.php on line 9 string(12) "HELLO, WORLD" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43998&edit=1

« previous php.bugs (#121832) next »