Fixed bug #61527 (Recursive/ArrayIterator gives misleading notice when array empty or moved to the end)#38
Fixed bug #61527 (Recursive/ArrayIterator gives misleading notice when array empty or moved to the end)#38reeze wants to merge 1 commit intophp:PHP-5.3from
Conversation
ext/spl/spl_array.c
Outdated
There was a problem hiding this comment.
This probably should be ht, as that's what you're passing into the macro.
|
update: error messsage updated & if else branch cleanup |
|
Thanks for reply, I will updated it soon;) |
|
btw are you sure the bug id is correct? The bug you refer to is closed and has little to do with your change. |
|
Which bug you are trying to fix? Bug #61347 is "inconsistent isset behavior of Arrayobject" and already fixed. |
|
There should be no messages when array is iterated to an end - it is perfectly normal thing to do. Empty array is a perfectly normal thing too, there should be no messages on that either. Also, I don't see why array should be rewinded. If it's at the end, it should just stay there. |
|
sorry ,my fault it's Bug#61527 |
|
I agree with @smalyshev here. It's perfectly valid to iterate over an empty array. As #61527 points out, there shouldn't be any Notice at all in those cases. |
|
em, it makes sense, next() didn't notice too. so no notice at all in this case, am I right? |
|
but the method related to current entry still need notice if array was empty or reached the end. thanks |
|
I have updated the patch:
@smalyshev I've already rebased the pull request, that has been updated. the previous code show up in discussion. "There should be no messages when array is iterated to an end - it is perfectly normal thing to do. Empty array is a perfectly normal thing too, there should be no messages on that either. Also, I don't see why array should be rewinded. If it's at the end, it should just stay there." Thanks. |
|
current() should not give any notices either. It should just return false. That notice does not contribute anything. |
|
actually, I think only notice for :"modified outside" is enough. no need yelling for "reached the end" |
…n array empty or moved to the end)
|
Hi, Thanks. |
|
Comment on behalf of stas at php.net: merged |
Hi,
when calling
- ArrayIterator->next(),
- ArrayIterator->key(),
- ArrayIterator->current(),
- RecurseArrayIterator->getChildren()
- RecurseArrayIterator->hasChildren()
it will raise misleading(array was modified outside) message. when array was empty or moved to then end of array.
This pull request is trying to fix it.
Thanks.