Skip to content

Commit 9f8a5ca

Browse files
committed
Use is_numeric_string_ex() to avoid mislabelling numeric strings as non-numeric
1 parent 9152f3b commit 9f8a5ca

19 files changed

+389
-388
lines changed

Zend/tests/assign_op_type_error.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ try {
4747

4848
?>
4949
--EXPECT--
50-
Unsupported operand types: array + non-numeric-string
51-
Unsupported operand types: array - non-numeric-string
52-
Unsupported operand types: array * non-numeric-string
53-
Unsupported operand types: array / non-numeric-string
54-
Unsupported operand types: array ** non-numeric-string
55-
Unsupported operand types: array % non-numeric-string
56-
Unsupported operand types: array << non-numeric-string
57-
Unsupported operand types: array >> non-numeric-string
50+
Unsupported operand types: array + string
51+
Unsupported operand types: array - string
52+
Unsupported operand types: array * string
53+
Unsupported operand types: array / string
54+
Unsupported operand types: array ** string
55+
Unsupported operand types: array % string
56+
Unsupported operand types: array << string
57+
Unsupported operand types: array >> string

Zend/tests/attributes/030_strict_types.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object(MyAttribute)#1 (1) {
2323
int(42)
2424
}
2525

26-
Fatal error: Uncaught TypeError: MyAttribute::__construct(): Argument #1 ($value) must be of type int, non-numeric-string given, called in %s030_strict_types.inc on line 4 and defined in %s030_strict_types.php:5
26+
Fatal error: Uncaught TypeError: MyAttribute::__construct(): Argument #1 ($value) must be of type int, string given, called in %s030_strict_types.inc on line 4 and defined in %s030_strict_types.php:5
2727
Stack trace:
2828
#0 %s030_strict_types.inc(4): MyAttribute->__construct('42')
2929
#1 %s(%d): ReflectionAttribute->newInstance()

Zend/tests/first_class_callable/first_class_callable_015.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ try {
2121
?>
2222
--EXPECTF--
2323
int(42)
24-
test(): Argument #1 ($i) must be of type int, non-numeric-string given, called in %s on line %d
24+
test(): Argument #1 ($i) must be of type int, string given, called in %s on line %d

Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ Too few arguments to function bar(), 1 passed in %s and exactly 2 expected
5050
ArgumentCountError
5151
Too few arguments to function bat(), 1 passed in %s and exactly 2 expected
5252
TypeError
53-
bat(): Argument #1 ($foo) must be of type int, non-numeric-string given, called in %s on line %d
53+
bat(): Argument #1 ($foo) must be of type int, string given, called in %s on line %d
5454
TypeError
5555
bat(): Argument #2 ($bar) must be of type string, int given, called in %s on line %d

Zend/tests/gh19719.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ try {
1818

1919
?>
2020
--EXPECTF--
21-
takesInt(): Argument #1 ($x) must be of type int, non-numeric-string given, called in %s on line %d
21+
takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d

Zend/tests/operator_unsupported_types.phpt

Lines changed: 164 additions & 164 deletions
Large diffs are not rendered by default.

Zend/tests/type_declarations/literal_types/true_no_coercion.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ try {
2929
?>
3030
--EXPECTF--
3131
test(): Argument #1 ($v) must be of type true, int given, called in %s on line %d
32-
test(): Argument #1 ($v) must be of type true, non-numeric-string given, called in %s on line %d
32+
test(): Argument #1 ($v) must be of type true, string given, called in %s on line %d
3333
test(): Argument #1 ($v) must be of type true, array given, called in %s on line %d
3434
test(): Argument #1 ($v) must be of type true, stdClass given, called in %s on line %d

Zend/tests/type_declarations/scalar_strict_64bit.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Testing 'int' type:
6060
int(1)
6161

6262
*** Trying string(1) "1"
63-
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, non-numeric-string given, called in %s on line %d
63+
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
6464

6565
*** Trying float(1)
6666
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
@@ -113,7 +113,7 @@ Testing 'float' type:
113113
float(1)
114114

115115
*** Trying string(1) "1"
116-
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, non-numeric-string given, called in %s on line %d
116+
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
117117

118118
*** Trying float(1)
119119
float(1)
@@ -219,7 +219,7 @@ Testing 'bool' type:
219219
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, int given, called in %s on line %d
220220

221221
*** Trying string(1) "1"
222-
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, non-numeric-string given, called in %s on line %d
222+
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
223223

224224
*** Trying float(1)
225225
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d

Zend/tests/type_declarations/scalar_strict_basic.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int(1)
6060
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, float given, called in %s on line %d
6161

6262
*** Trying string value
63-
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, non-numeric-string given, called in %s on line %d
63+
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, string given, called in %s on line %d
6464

6565
*** Trying true value
6666
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, bool given, called in %s on line %d
@@ -89,7 +89,7 @@ float(1)
8989
float(1)
9090

9191
*** Trying string value
92-
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, non-numeric-string given, called in %s on line %d
92+
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, string given, called in %s on line %d
9393

9494
*** Trying true value
9595
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, bool given, called in %s on line %d
@@ -147,7 +147,7 @@ Testing 'bool' type:
147147
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, float given, called in %s on line %d
148148

149149
*** Trying string value
150-
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, non-numeric-string given, called in %s on line %d
150+
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, string given, called in %s on line %d
151151

152152
*** Trying true value
153153
bool(true)

Zend/tests/type_declarations/union_types/type_checking_strict.phpt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ Type int|float:
6666
42 => 42
6767
42.0 => 42.0
6868
INF => INF
69-
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, non-numeric-string given
70-
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, non-numeric-string given
69+
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given
70+
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, string given
7171
"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, non-numeric-string given
7272
"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, non-numeric-string given
7373
"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float, empty-string given
@@ -82,8 +82,8 @@ Type int|float|false:
8282
42 => 42
8383
42.0 => 42.0
8484
INF => INF
85-
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, non-numeric-string given
86-
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, non-numeric-string given
85+
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given
86+
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, string given
8787
"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, non-numeric-string given
8888
"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, non-numeric-string given
8989
"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|false, empty-string given
@@ -98,8 +98,8 @@ Type int|float|bool:
9898
42 => 42
9999
42.0 => 42.0
100100
INF => INF
101-
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, non-numeric-string given
102-
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, non-numeric-string given
101+
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, string given
102+
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, string given
103103
"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, non-numeric-string given
104104
"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, non-numeric-string given
105105
"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|float|bool, empty-string given
@@ -114,8 +114,8 @@ Type int|bool:
114114
42 => 42
115115
42.0 => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, float given
116116
INF => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, float given
117-
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, non-numeric-string given
118-
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, non-numeric-string given
117+
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, string given
118+
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, string given
119119
"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, non-numeric-string given
120120
"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, non-numeric-string given
121121
"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type int|bool, empty-string given
@@ -162,8 +162,8 @@ Type float|array:
162162
42 => 42.0
163163
42.0 => 42.0
164164
INF => INF
165-
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, non-numeric-string given
166-
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, non-numeric-string given
165+
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given
166+
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, string given
167167
"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, non-numeric-string given
168168
"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, non-numeric-string given
169169
"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|float, empty-string given
@@ -194,8 +194,8 @@ Type bool|array:
194194
42 => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, int given
195195
42.0 => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, float given
196196
INF => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, float given
197-
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, non-numeric-string given
198-
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, non-numeric-string given
197+
"42" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, string given
198+
"42.0" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, string given
199199
"42x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, non-numeric-string given
200200
"x" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, non-numeric-string given
201201
"" => {closure:%s:%d}(): Argument #1 ($arg) must be of type array|bool, empty-string given

0 commit comments

Comments
 (0)