File tree Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ String interning during constants substitution
44opcache.enable_cli=0
55--FILE--
66<?php
7- define ("A " , ". " . ord (26 ) . ". " );
7+ define ("A " , ". " . ord (2 ) . ". " );
88eval ("class A {const a = A;} " );
99var_dump (A::a);
1010?>
Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ Deprecated: chr(): Passing null to parameter #1 ($codepoint) of type int is depr
5353string(1) "%s"
5454
5555Deprecated: ord(): Passing null to parameter #1 ($character) of type string is deprecated in %s on line %d
56+
57+ Deprecated: ord(): Providing an empty string is deprecated in %s on line %d
5658int(0)
5759string(98) "call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given"
5860string(77) "call_user_func_array(): Argument #2 ($args) must be of type array, null given"
Original file line number Diff line number Diff line change @@ -2652,8 +2652,13 @@ PHP_FUNCTION(ord)
26522652 ZEND_PARSE_PARAMETERS_END ();
26532653
26542654 if (UNEXPECTED (ZSTR_LEN (str ) != 1 )) {
2655- php_error_docref (NULL , E_DEPRECATED ,
2656- "Providing a string which is not one byte long is deprecated, use ord($str[0]) instead" );
2655+ if (ZSTR_LEN (str ) == 0 ) {
2656+ php_error_docref (NULL , E_DEPRECATED ,
2657+ "Providing an empty string is deprecated" );
2658+ } else {
2659+ php_error_docref (NULL , E_DEPRECATED ,
2660+ "Providing a string which is not one byte long is deprecated, use ord($str[0]) instead" );
2661+ }
26572662 }
26582663 RETURN_LONG ((unsigned char ) ZSTR_VAL (str )[0 ]);
26592664}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ var_dump(ord("Hello"));
88
99?>
1010--EXPECTF--
11- Deprecated: ord(): Providing a string which is not one byte long is deprecated, use ord($str[0]) instead in %s on line 3
11+ Deprecated: ord(): Providing an empty string is deprecated in %s on line 3
1212int(0)
1313
1414Deprecated: ord(): Providing a string which is not one byte long is deprecated, use ord($str[0]) instead in %s on line 4
You can’t perform that action at this time.
0 commit comments