Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bug 81160 #7173

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
@@ -19,6 +19,16 @@ PHP 8.4 UPGRADE NOTES
1. Backward Incompatible Changes
========================================

- Core:
. isset() and empty() now check that the offset for string values is of the
correct type i.e. numeric, similarly to array and objects.
This means code similar to:
$a = 'string';
var_dump(isset($a['b']));
var_dump(empty($a['b']));
Comment on lines +26 to +28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw: PHPStan also warns in this constellation:

https://phpstan.org/r/3b26cd4f-bdd1-470a-9b8f-1f42eb1386ee

will now warn with: "Cannot access offset of type string on string"
when previously it silently returned false.

- DOM:
. New methods and constants were added to some DOM classes. If you inherit
from these and you happen to have a method or property with the same name,
3 changes: 2 additions & 1 deletion Zend/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
@@ -5115,7 +5115,8 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op
return 0;
}
case ZEND_FETCH_IS:
return (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT));
return (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT))
|| (t1 & MAY_BE_STRING && t2 & MAY_BE_STRING);
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
return (t1 & MAY_BE_OBJECT) || (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT));
case ZEND_FETCH_DIM_IS:
75 changes: 0 additions & 75 deletions Zend/tests/bug60362.phpt

This file was deleted.

11 changes: 0 additions & 11 deletions Zend/tests/bug62680.phpt

This file was deleted.

21 changes: 0 additions & 21 deletions Zend/tests/bug69889.phpt

This file was deleted.

135 changes: 0 additions & 135 deletions Zend/tests/empty_str_offset.phpt

This file was deleted.

Loading