xref: /PHP-5.3/ext/mbstring/tests/bug43998.phpt (revision 4a78652f)
1--TEST--
2Test mb_strtolower() function : Two error messages returned for incorrect encoding for mb_strto[upper|lower]
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip');
6function_exists('mb_strtolower') or die("skip mb_strtolower() is not available in this build");
7?>
8--FILE--
9<?php
10/* Prototype  : string mb_strto[lower|upper](string $sourcestring [, string $encoding])
11 * Description: Returns a [lower|upper]cased version of $sourcestring
12 * Source code: ext/mbstring/mbstring.c
13 */
14
15/*
16 * Two error messages returned for incorrect encoding for mb_strto[upper|lower]
17 * Bug now appears to be fixed
18 */
19
20$sourcestring = 'Hello, World';
21
22$inputs = array(12345, 12.3456789000E-10, true, false, "");
23$iterator = 1;
24foreach($inputs as $input) {
25  echo "\n-- Iteration $iterator --\n";
26  var_dump( mb_strtolower($sourcestring, $input) );
27  var_dump( mb_strtoupper($sourcestring, $input) );
28  $iterator++;
29};
30?>
31--EXPECTF--
32
33-- Iteration 1 --
34
35Warning: mb_strtolower(): Unknown encoding "12345" in %s on line %d
36bool(false)
37
38Warning: mb_strtoupper(): Unknown encoding "12345" in %s on line %d
39bool(false)
40
41-- Iteration 2 --
42
43Warning: mb_strtolower(): Unknown encoding "1.23456789E-9" in %s on line %d
44bool(false)
45
46Warning: mb_strtoupper(): Unknown encoding "1.23456789E-9" in %s on line %d
47bool(false)
48
49-- Iteration 3 --
50
51Warning: mb_strtolower(): Unknown encoding "1" in %s on line %d
52bool(false)
53
54Warning: mb_strtoupper(): Unknown encoding "1" in %s on line %d
55bool(false)
56
57-- Iteration 4 --
58
59Warning: mb_strtolower(): Unknown encoding "" in %s on line %d
60bool(false)
61
62Warning: mb_strtoupper(): Unknown encoding "" in %s on line %d
63bool(false)
64
65-- Iteration 5 --
66
67Warning: mb_strtolower(): Unknown encoding "" in %s on line %d
68bool(false)
69
70Warning: mb_strtoupper(): Unknown encoding "" in %s on line %d
71bool(false)
72