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