From:             josmessa at uk dot ibm dot com
Operating system: Windows XP SP2
PHP version:      5.2CVS-2008-01-31 (snap)
PHP Bug Type:     mbstring related
Bug description:  Two error messages returned for incorrect encoding for 
mb_strto[upper|lower]

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 bug report at http://bugs.php.net/?id=43998&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43998&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43998&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43998&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43998&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43998&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43998&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43998&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43998&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43998&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43998&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43998&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43998&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43998&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43998&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43998&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43998&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43998&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43998&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43998&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43998&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43998&r=mysqlcfg

Reply via email to