#43998 [Asn->Fbk]: Two error messages returned for incorrect encoding for mb_strto[upper|lower]
| From: | hirokawa@php.net | Date: | Sat, 16 Feb 2008 12:01:54 +0000 |
| Subject: | #43998 [Asn->Fbk]: 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-122343@lists.php.net to get a copy of this message | ||
ID: 43998
Updated by: hirokawa@php.net
Reported By: josmessa at uk dot ibm dot com
-Status: Assigned
+Status: Feedback
Bug Type: mbstring related
Operating System: Windows XP SP2
PHP Version: 5.2CVS-2008-01-31 (snap)
Assigned To: hirokawa
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.3-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.3-win32-installer-latest.msi
Previous Comments:
------------------------------------------------------------------------
[2008-01-31 17:04:13] nicholsr@php.net
Assign to extension maintainer
------------------------------------------------------------------------
[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