Two error messages returned for incorrect encoding for mb_strto[upper|lower]
| Bug #43998 | Two error messages returned for incorrect encoding for mb_strto[upper|lower] | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2008-01-31 16:09 UTC | Modified: | 2008-02-26 01:00 UTC |
|
||||||
| From: | jmessa@php.net | Assigned: | hirokawa (profile) | |||||||
| Status: | No Feedback | Package: | mbstring related | |||||||
| PHP Version: | 5.2CVS-2008-01-31 (snap) | OS: | Windows XP SP2 | |||||||
| Private report: | No | CVE-ID: | None | |||||||
[2008-01-31 16:09 UTC] jmessa@php.net
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"
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2008-02-18 14:20 UTC] jmessa@php.net
[2008-02-26 01:00 UTC] php-bugs at lists dot php dot net