-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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 GH-16905: Internal iterator functions can't handle UNDEF properties #16907
base: PHP-8.2
Are you sure you want to change the base?
Conversation
Actually, throwing may be more appropriate here... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, throwing may be more appropriate here...
If we're following the behavior of foreach
, then skipping the unset property would be most appropriate.
ext/standard/array.c
Outdated
RETURN_FALSE; | ||
} | ||
|
||
if (Z_TYPE_P(entry) == IS_INDIRECT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: May use ZVAL_DEINDIRECT()
.
That said, this behavior is deprecated, so a complicated solution might not be necessary. Throwing until we eventually remove the feature sounds acceptable. |
I guess this makes sense; I'll see how easy it is to do |
Made that change, turns out that was quite easy to do. |
ext/standard/array.c
Outdated
} | ||
|
||
RETURN_COPY_DEREF(entry); | ||
ia_return_current(return_value, array, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will implicitly advance when the current element is unset. E.g. with a current(), unset(), current()
. I think it would be reasonable for current()
not to advance, but to throw if the element is undef.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's fair, same for key(), let me fix this.
Unfortunately, I found out that |
No description provided.