Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Zend/tests/024.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@ var_dump($a->$b->{$c[1]});
?>
--EXPECTF--
Notice: Undefined variable: a in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Undefined variable: %s in %s on line %d
Notice: Undefined variable: a in %s on line %d

Notice: Undefined variable: c in %s on line %d

Notice: Undefined variable: %s in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Undefined variable: a in %s on line %d
int(1)

Notice: Undefined variable: %s in %s on line %d
Notice: Undefined variable: a in %s on line %d

Notice: Undefined variable: %s in %s on line %d
Notice: Undefined variable: b in %s on line %d
int(0)

Notice: Undefined variable: a in %s on line %d
Expand All @@ -45,6 +49,8 @@ NULL

Notice: Undefined variable: c in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to get property '1' of non-object in %s on line %d

Notice: Trying to get property '' of non-object in %s on line %d
Expand Down
30 changes: 30 additions & 0 deletions Zend/tests/033.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,40 @@ $arr[][]->bar = 2;
--EXPECTF--
Notice: Undefined variable: arr in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Undefined variable: arr in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Undefined variable: arr in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to get property 'foo' of non-object in %s on line %d

Warning: Creating default object from empty value in %s on line %d
Expand Down
3 changes: 2 additions & 1 deletion Zend/tests/assign_to_var_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ var_dump($var1);

echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Notice: Trying to access array offset on value of type float in %s on line %d
NULL
NULL
Done
2 changes: 2 additions & 0 deletions Zend/tests/call_user_func_007.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ var_dump($a);
--EXPECTF--
Notice: Undefined offset: 0 in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Warning: Parameter 1 to foo() expected to be a reference, value given in %s on line %d
array(0) {
}
2 changes: 2 additions & 0 deletions Zend/tests/dereference_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ array(2) {
int(5)
}
int(1)

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Undefined offset: 4 in %s on line %d
Expand Down
3 changes: 3 additions & 0 deletions Zend/tests/dereference_010.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ var_dump(b()[1]);

?>
--EXPECTF--
Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Fatal error: Uncaught Error: Cannot use object of type stdClass as array in %s:%d
Expand Down
4 changes: 4 additions & 0 deletions Zend/tests/dereference_014.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ var_dump($h);

?>
--EXPECTF--
Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to get property 'a' of non-object in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to get property 'b' of non-object in %s on line %d
NULL
2 changes: 2 additions & 0 deletions Zend/tests/isset_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Notice: Undefined variable: c in %s on line %d

Notice: Undefined variable: d in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Notice: Trying to get property '' of non-object in %s on line %d
bool(false)
bool(true)
Expand Down
19 changes: 18 additions & 1 deletion Zend/tests/offset_bool.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,31 @@ var_dump($bool[$arr]);

echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Notice: Trying to access array offset on value of type bool in %s on line %d
NULL

Notice: Trying to access array offset on value of type bool in %s on line %d
NULL

Notice: Trying to access array offset on value of type bool in %s on line %d
NULL

Notice: Trying to access array offset on value of type bool in %s on line %d
NULL

Notice: Trying to access array offset on value of type bool in %s on line %d
NULL

Notice: Trying to access array offset on value of type bool in %s on line %d
NULL

Notice: Trying to access array offset on value of type bool in %s on line %d
NULL

Notice: Trying to access array offset on value of type bool in %s on line %d
NULL

Notice: Trying to access array offset on value of type bool in %s on line %d
NULL
Done
19 changes: 18 additions & 1 deletion Zend/tests/offset_long.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,31 @@ var_dump($long[$arr]);

echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL

Notice: Trying to access array offset on value of type int in %s on line %d
NULL
Done
19 changes: 18 additions & 1 deletion Zend/tests/offset_null.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,31 @@ var_dump($null[$arr]);

echo "Done\n";
?>
--EXPECT--
--EXPECTF--
Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Trying to access array offset on value of type null in %s on line %d
NULL
Done
6 changes: 5 additions & 1 deletion Zend/zend_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -2390,11 +2390,15 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
}
} else {
if (type != BP_VAR_IS && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
container = ZVAL_UNDEFINED_OP1();
}
if (/*dim_type == IS_CV &&*/ UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
}
if (!is_list && type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to access array offset on value of type %s",
zend_zval_type_name(container));
}
ZVAL_NULL(result);
}
}
Expand Down
6 changes: 4 additions & 2 deletions ext/spl/tests/array_026.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ $test['d1']['d3'] = 'world';
var_dump($test, $test3['mmmmm']);
?>
--EXPECTF--
Notice: Undefined variable: test3 in %s%earray_026.php on line %d
object(ArrayObject)#%d (1) {
Notice: Undefined variable: test3 in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
["d1"]=>
Expand Down
2 changes: 2 additions & 0 deletions ext/spl/tests/bug62978.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Notice: Undefined index: epic_magic in %sbug62978.php on line %d
NULL

Notice: Undefined variable: c in %sbug62978.php on line %d

Notice: Trying to access array offset on value of type null in %s on line %d
NULL

Notice: Undefined index: epic_magic in %sbug62978.php on line %d
Expand Down
2 changes: 2 additions & 0 deletions ext/standard/tests/array/bug31158.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ echo "ok\n";
?>
--EXPECTF--
Notice: Undefined variable: GLOBALS in %sbug31158.php on line 6

Notice: Trying to access array offset on value of type null in %sbug31158.php on line 6
ok
1 change: 1 addition & 0 deletions tests/lang/bug25922.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ test();
?>
--EXPECT--
Undefined variable: data
Trying to access array offset on value of type null
Undefined index here: ''
6 changes: 4 additions & 2 deletions tests/lang/passByReference_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ var_dump($undef2)
--EXPECTF--
Passing undefined by value

Notice: Undefined variable: undef1 in %s on line 13
Notice: Undefined variable: undef1 in %s on line %d

Notice: Trying to access array offset on value of type null in %s on line %d

Inside passbyVal call:
NULL

After call

Notice: Undefined variable: undef1 in %s on line 15
Notice: Undefined variable: undef1 in %s on line %d
NULL

Passing undefined by reference
Expand Down