php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
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
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jmessa@php.net
New email:
PHP Version: OS:

 

 [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 commitsRelated reports
 [2008-01-31 17:04 UTC] nicholsr@php.net
Assign to extension maintainer
 [2008-02-18 14:20 UTC] jmessa@php.net
I've run the above example on the latest 5.2 and 5.3 snapshots and it's
behaving as I expected now. Thanks for making the change!
 [2008-02-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC