Skip to content

Commit 641fe23

Browse files
Improve illegal offset error messages (#10504)
Co-authored-by: Marcos Marcolin <[email protected]>
1 parent 66a1a91 commit 641fe23

32 files changed

+151
-106
lines changed

Zend/tests/036.phpt

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

1212
?>
1313
--EXPECT--
14-
Illegal offset type
14+
Cannot access offset of type object on array

Zend/tests/038.phpt

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

1212
?>
1313
--EXPECT--
14-
Illegal offset type
14+
Cannot access offset of type object on array

Zend/tests/assign_dim_obj_null_return.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ test();
7272
?>
7373
--EXPECT--
7474
Cannot add element to the array as the next element is already occupied
75-
Illegal offset type
76-
Illegal offset type
75+
Cannot access offset of type array on array
76+
Cannot access offset of type object on array
7777
Cannot use a scalar value as an array
7878
Cannot add element to the array as the next element is already occupied
79-
Illegal offset type
80-
Illegal offset type
79+
Cannot access offset of type array on array
80+
Cannot access offset of type object on array
8181
Cannot use a scalar value as an array
8282
Attempt to assign property "foo" on true
8383
Attempt to assign property "foo" on true

Zend/tests/bug79790.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function b($a = array()[array ()]) {
88
}
99
?>
1010
--EXPECTF--
11-
Fatal error: Uncaught TypeError: Illegal offset type in %s:%d
11+
Fatal error: Uncaught TypeError: Cannot access offset of type array on array in %s:%d
1212
Stack trace:
1313
#0 %s(%d): b()
1414
#1 {main}

Zend/tests/bug79947.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ try {
1212
var_dump($array);
1313
?>
1414
--EXPECT--
15-
Illegal offset type
15+
Cannot access offset of type array on array
1616
array(0) {
1717
}

Zend/tests/bug80781.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (isset($array[$data]) or getPlugin($data)) {
2525

2626
?>
2727
--EXPECTF--
28-
Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in %s:%d
28+
Fatal error: Uncaught TypeError: Cannot access offset of type array in isset or empty in %s:%d
2929
Stack trace:
3030
#0 {main}
3131
thrown in %s on line %d

Zend/tests/constant_expressions_invalid_offset_type_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const C2 = [C1, [] => 1];
88

99
?>
1010
--EXPECTF--
11-
Fatal error: Uncaught TypeError: Illegal offset type in %s:%d
11+
Fatal error: Uncaught TypeError: Cannot access offset of type array on array in %s:%d
1212
Stack trace:
1313
#0 {main}
1414
thrown in %s on line %d

Zend/tests/gh8821.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ new Bravo();
1515

1616
?>
1717
--EXPECTF--
18-
Fatal error: Uncaught TypeError: Illegal offset type in %sgh8821.php:8
18+
Fatal error: Uncaught TypeError: Cannot access offset of type object on array in %sgh8821.php:8
1919
Stack trace:
2020
#0 %sgh8821.php(11): [constant expression]()
2121
#1 {main}

Zend/tests/illegal_offset_unset_isset_empty.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ try {
2222

2323
?>
2424
--EXPECT--
25-
Illegal offset type in unset
26-
Illegal offset type in isset or empty
27-
Illegal offset type in isset or empty
25+
Cannot access offset of type array in unset
26+
Cannot access offset of type array in isset or empty
27+
Cannot access offset of type array in isset or empty

Zend/tests/init_array_illegal_offset_type.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ try {
1212
}
1313
?>
1414
--EXPECT--
15-
Illegal offset type
15+
Cannot access offset of type object on array

0 commit comments

Comments
 (0)