-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Validator Message Group iteration incorrect behavior after unsetting a message index #12455
Comments
That should not work that way. |
But unset should work too. It's implementing ArrayAccess. When doing unset it's calling offsetUnset anyway. |
@Jurigag is right. In fact, I thinks you should not use directly Have a look at the code exemple just below the method documentation ;) |
Yes, the change is working. I've added a pull request for the change after checking that it's working properly. Not sure if there is another pull request already about this, but just in case I went ahead. |
Fixed in the |
Hi, I just ran into a bug trying to iterate a Phalcon\Validation\Message\Group after having unset a message index. Here is an exemple :
FYI, if you have to iterate with this problem you cant use the following hack.
The problem can easily be fixed by replacing
unset this->_messages[index];
by anarray_splice
in the following function of https://github.com/phalcon/cphalcon/blob/master/phalcon/validation/message/group.zep#L115Just like that :
Details
The text was updated successfully, but these errors were encountered: