xref: /php-src/ext/ctype/tests/bug25745.phpt (revision 08069165)
1--TEST--
2Bug #25745 (ctype functions fail with non-ascii characters)
3--EXTENSIONS--
4ctype
5--INI--
6error_reporting=E_ALL&~E_DEPRECATED
7--FILE--
8<?php
9$funcs = array(
10    "ctype_alnum", "ctype_alpha", "ctype_cntrl", "ctype_digit",
11    "ctype_graph", "ctype_lower", "ctype_print", "ctype_punct",
12    "ctype_space", "ctype_upper", "ctype_xdigit"
13);
14
15foreach ($funcs as $ctype_func) {
16    for ($i = 0; $i < 256; $i++) {
17        $a = $ctype_func($i);
18        $b = $ctype_func(chr($i));
19        if ($a != $b) {
20            echo "broken... $ctype_func($i) = $a, $ctype_func(chr($i)) = $b\n";
21            exit;
22        }
23    }
24}
25echo "ok\n";
26?>
27--EXPECT--
28ok
29