diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-10 10:28:58 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-10 12:02:14 +0200 |
commit | c42b7dd6d32b43304b76452add158a2ef325d494 (patch) | |
tree | 2f96b8b2a669157a3a519e7cb9a068567b90bbcd /Zend/tests/offset_long.phpt | |
parent | a63422029ea2462caf949b7a0b4983e67109d4f2 (diff) | |
download | php-git-c42b7dd6d32b43304b76452add158a2ef325d494.tar.gz |
Throw notice on array access on illegal type
No notice is thrown for list() accesses, because we did not come
to an agreement regarding patterns like
while ([$key, $value] = yield $it->next()) { ... }
where silent null access may be desirable.
No effort is made to suppress multiple notices in access chains
likes $x[0][0][0], because the technical complexity this causes
does not seem worthwhile.
RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
Diffstat (limited to 'Zend/tests/offset_long.phpt')
-rw-r--r-- | Zend/tests/offset_long.phpt | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Zend/tests/offset_long.phpt b/Zend/tests/offset_long.phpt index 98b9b0f08b..4c6b3972d2 100644 --- a/Zend/tests/offset_long.phpt +++ b/Zend/tests/offset_long.phpt @@ -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 |