Deprecate ctype_*() on non-string arguments

Non-string arguments will be interpreted as strings in the future.
Warn about the upcoming behavior change.

Part of https://wiki.php.net/rfc/deprecations_php_8_1.
This commit is contained in:
Nikita Popov 2021-07-09 10:56:01 +02:00
parent a09754b3d3
commit 08069165aa
29 changed files with 502 additions and 40 deletions

View file

@ -334,6 +334,16 @@ PHP 8.1 UPGRADE NOTES
. Returning by reference from a void function is deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
- Ctype:
. Passing a non-string value to ctype_*() functions is deprecated. A future
version of PHP will make ctype_*() accept a string argument, which means
that either only strings will be accepted (strict_types=1) or inputs may be
converted to string (strict_types=0). In particular, using ctype_*($cp) to
check whether an ASCII codepoint given as integer satisfies a given ctype
predicate will no longer be supported. Instead ctype_*(chr($cp)) should be
used.
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
- Date:
. The date_sunrise() and date_sunset() functions have been deprecated in
favor of date_sun_info().

View file

@ -69,6 +69,21 @@ static void ctype_impl(
Z_PARAM_ZVAL(c)
ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(c) == IS_STRING) {
char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c);
if (e == p) {
RETURN_FALSE;
}
while (p < e) {
if (!iswhat((int)*(unsigned char *)(p++))) {
RETURN_FALSE;
}
}
RETURN_TRUE;
}
php_error_docref(NULL, E_DEPRECATED,
"Argument of type %s will be interpreted as string in the future", zend_zval_type_name(c));
if (Z_TYPE_P(c) == IS_LONG) {
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) {
RETURN_BOOL(iswhat((int)Z_LVAL_P(c)));
@ -79,17 +94,6 @@ static void ctype_impl(
} else {
RETURN_BOOL(allow_minus);
}
} else if (Z_TYPE_P(c) == IS_STRING) {
char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c);
if (e == p) {
RETURN_FALSE;
}
while (p < e) {
if(!iswhat((int)*(unsigned char *)(p++))) {
RETURN_FALSE;
}
}
RETURN_TRUE;
} else {
RETURN_FALSE;
}

View file

@ -2,17 +2,20 @@
ctype on integers
--EXTENSIONS--
ctype
--INI--
error_reporting=E_ALL&~E_DEPRECATED
--FILE--
<?php
setlocale(LC_ALL,"C");
setlocale(LC_ALL,"C");
function ctype_test_001($function) {
function ctype_test_001($function) {
$n=0;
for($a=0;$a<256;$a++) {
if($function($a)) $n++;
}
echo "$function $n\n";
}
echo "$function $n\n";
}
ctype_test_001("ctype_lower");
ctype_test_001("ctype_upper");
ctype_test_001("ctype_alpha");

View file

@ -13,7 +13,7 @@ function ctype_test_002($function) {
// test portable POSIX characters 0..127
for ($a=0;$a<128;$a++) {
$c = chr($a);
if($function($a)) $n1++;
if($function($c)) $n1++;
if($function("$c$c$c")) $n2++;
if($function("1-$c$c$c-x")) $n3++;
}

View file

@ -2,6 +2,8 @@
Bug #25745 (ctype functions fail with non-ascii characters)
--EXTENSIONS--
ctype
--INI--
error_reporting=E_ALL&~E_DEPRECATED
--FILE--
<?php
$funcs = array(

View file

@ -8,6 +8,7 @@ $id = 394829384;
var_dump(ctype_digit($id));
var_dump($id);
?>
--EXPECT--
--EXPECTF--
Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
int(394829384)

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_alnum() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_alnum(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_alnum(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_alnum(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 4 --
Deprecated: ctype_alnum(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_alnum(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_alnum(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_alnum(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_alnum(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_alnum(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_alnum(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_alnum(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_alnum(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_alnum(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_alnum(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_alnum(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_alnum(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_alnum(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_alnum(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_alnum(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_alnum(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_alnum() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
if (ctype_alnum($i)) {
if (ctype_alnum(chr($i))) {
echo "character code $i is alpha numeric\n";
}
}

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_alpha() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_alpha(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_alpha(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_alpha(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 4 --
Deprecated: ctype_alpha(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_alpha(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_alpha(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_alpha(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_alpha(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_alpha(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_alpha(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_alpha(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_alpha(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_alpha(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_alpha(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_alpha(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_alpha(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_alpha(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_alpha(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_alpha(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_alpha(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_alpha() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
if (ctype_alpha($i)) {
if (ctype_alpha(chr($i))) {
echo "character code $i is alphabetic\n";
}
}

View file

@ -94,52 +94,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_cntrl() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_cntrl(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 2 --
Deprecated: ctype_cntrl(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 3 --
Deprecated: ctype_cntrl(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 4 --
Deprecated: ctype_cntrl(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_cntrl(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_cntrl(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_cntrl(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_cntrl(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_cntrl(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_cntrl(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_cntrl(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_cntrl(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_cntrl(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_cntrl(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_cntrl(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -149,6 +179,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_cntrl(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -161,13 +193,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_cntrl(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_cntrl(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_cntrl(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_cntrl(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_cntrl() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
if (ctype_cntrl($i)) {
if (ctype_cntrl(chr($i))) {
echo "character code $i is control character\n";
}
}

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_digit() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 4 --
Deprecated: ctype_digit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_digit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_digit(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_digit(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_digit(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_digit(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_digit(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_digit(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_digit(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_digit(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_digit(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_digit(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_digit(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_digit() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
if (ctype_digit($i)) {
if (ctype_digit(chr($i))) {
echo "character code $i is a numeric digit\n";
}
}

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_graph() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_graph(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_graph(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_graph(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 4 --
Deprecated: ctype_graph(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 5 --
Deprecated: ctype_graph(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_graph(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_graph(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_graph(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_graph(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_graph(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_graph(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_graph(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_graph(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_graph(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_graph(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_graph(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_graph(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_graph(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_graph(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_graph(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_graph() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
if (ctype_graph($i)) {
if (ctype_graph(chr($i))) {
echo "character code $i is a printable character\n";
}
}

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_lower() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_lower(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_lower(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_lower(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 4 --
Deprecated: ctype_lower(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_lower(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_lower(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_lower(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_lower(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_lower(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_lower(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_lower(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_lower(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_lower(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_lower(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_lower(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_lower(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_lower() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
if (ctype_lower($i)) {
if (ctype_lower(chr($i))) {
echo "character code $i is a lower case character\n";
}
}

View file

@ -16,7 +16,9 @@ var_dump(ctype_print($c2));
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_print() : basic functionality ***
bool(true)
Deprecated: ctype_print(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_print() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_print(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_print(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_print(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 4 --
Deprecated: ctype_print(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 5 --
Deprecated: ctype_print(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_print(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_print(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_print(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_print(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_print(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_print(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_print(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_print(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_print(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_print(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_print(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_print(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_print(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_print(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_print(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_print() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
if (ctype_print($i)) {
if (ctype_print(chr($i))) {
echo "character code $i is a printable character\n";
}
}

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_punct() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_punct(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_punct(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_punct(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 4 --
Deprecated: ctype_punct(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_punct(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_punct(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_punct(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_punct(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_punct(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_punct(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_punct(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_punct(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_punct(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_punct(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_punct(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_punct(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_punct(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_punct(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_punct(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_punct(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_punct() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($c = 1; $c < 256; $c++) {
if (ctype_punct($c)) {
if (ctype_punct(chr($c))) {
echo "character code $c is punctuation\n";
}
}

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_space() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_space(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_space(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_space(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 4 --
Deprecated: ctype_space(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_space(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_space(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_space(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_space(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_space(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_space(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_space(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_space(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_space(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_space(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_space(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_space(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_space(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_space(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_space(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_space(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_space() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($c = 1; $c < 256; $c++) {
if (ctype_space($c)) {
if (ctype_space(chr($c))) {
echo "character code $c is a space character\n";
}
}

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_upper() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_upper(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_upper(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_upper(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 4 --
Deprecated: ctype_upper(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_upper(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_upper(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_upper(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_upper(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_upper(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_upper(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_upper(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_upper(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_upper(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_upper(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_upper(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_upper(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_upper(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_upper(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_upper(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_upper(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -13,7 +13,7 @@ echo "*** Testing ctype_upper() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
if (ctype_upper($i)) {
if (ctype_upper(chr($i))) {
echo "character code $i is a uppercase character\n";
}
}

View file

@ -93,52 +93,82 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
--EXPECT--
--EXPECTF--
*** Testing ctype_xdigit() : usage variations ***
-- Iteration 1 --
Deprecated: ctype_xdigit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 2 --
Deprecated: ctype_xdigit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 3 --
Deprecated: ctype_xdigit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(true)
-- Iteration 4 --
Deprecated: ctype_xdigit(): Argument of type int will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 5 --
Deprecated: ctype_xdigit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 6 --
Deprecated: ctype_xdigit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 7 --
Deprecated: ctype_xdigit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 8 --
Deprecated: ctype_xdigit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 9 --
Deprecated: ctype_xdigit(): Argument of type float will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 10 --
Deprecated: ctype_xdigit(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 11 --
Deprecated: ctype_xdigit(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 12 --
Deprecated: ctype_xdigit(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 13 --
Deprecated: ctype_xdigit(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 14 --
Deprecated: ctype_xdigit(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 15 --
Deprecated: ctype_xdigit(): Argument of type bool will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 16 --
@ -148,6 +178,8 @@ bool(false)
bool(false)
-- Iteration 18 --
Deprecated: ctype_xdigit(): Argument of type array will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 19 --
@ -160,13 +192,21 @@ bool(true)
bool(true)
-- Iteration 22 --
Deprecated: ctype_xdigit(): Argument of type classA will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 23 --
Deprecated: ctype_xdigit(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 24 --
Deprecated: ctype_xdigit(): Argument of type null will be interpreted as string in the future in %s on line %d
bool(false)
-- Iteration 25 --
Deprecated: ctype_xdigit(): Argument of type resource will be interpreted as string in the future in %s on line %d
bool(false)

View file

@ -14,7 +14,7 @@ echo "*** Testing ctype_xdigit() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for($c = 1; $c < 256; $c++) {
if (ctype_xdigit($c)) {
if (ctype_xdigit(chr($c))) {
echo "character code $c is a hexadecimal 'digit'\n";
}
}