-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Avoid crash for reset/end/next/prev() on ffi classes #9711
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
Conversation
This will work of course, but I think it's safer to make a change in ext/ffi and return a mutable array. see #9716 |
I'll take a deeper look on Monday (January 30). |
As it seems to be fixing crashes I would say yes. |
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.
Lets commit this.
57af8bc
to
9dc675f
Compare
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.
All tests are broken because of missing skipif.inc
9dc675f
to
787a712
Compare
(And any PECLs returning `zend_empty_array` in the handler->get_properties overrides) Closes phpGH-9697 This is similar to the fix used in d9651a9 for array_walk. This should make it safer for php-src (and PECLs, long-term) to return the empty immutable array in `handler->get_properties` to avoid wasting memory. See php#9697 (comment) The only possible internal iterator position for the empty array is at the end of the empty array (nInternalPointer=0). The `zend_hash*del*` helpers will always set nInternalPointer to 0 when an array becomes empty, regardless of previous insertions/deletions/updates to the array.
787a712
to
b3937f7
Compare
(And any PECLs returning
&zend_empty_array
in the handler->get_properties overrides to save memory)Closes GH-9697
This is similar to the fix used in d9651a9 for array_walk.
This should make it safer for php-src (and PECLs, long-term) to return the empty immutable array in
handler->get_properties
to avoid wasting memory. See #9697 (comment)The only possible internal iterator position for the empty array is at the end of the empty array (nInternalPointer=0).
The
zend_hash*del*
helpers will always set nInternalPointer to 0 when an array becomes empty,regardless of previous insertions/deletions/updates to the array.