-
-
Notifications
You must be signed in to change notification settings - Fork 67
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 data loss on multiple Result#rewind()
calls
#273
Conversation
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 looks good to me, although I don't understand the code 🤣
To be clear, previously rewinding twice would lead to undefined behaviour?
Yes, as stated in referenced issue. Calling ->rewind() just caused one row to be read from database. Always. Even if current positions already was at the beginning of result. |
@Ocramius iirc, call |
Ok, given @samsonasik's feedback, could such a test be introduced, @Grundik? I'd then gladly merge, even at the risk of minor BC issues. |
As I can see, buffering for PDO results are explicitly disabled: /**
* @return void
*/
public function buffer()
{
}
/**
* @return bool|null
*/
public function isBuffered()
{
return false;
} So, this should not be an issue at all. |
That's on class implements laminas-db/src/ResultSet/AbstractResultSet.php Lines 97 to 108 in eff7c7d
|
This is my old blog post about |
Will this be enough? |
Yes, that's should be enough 👍 |
Signed-off-by: Grundik <grundik@ololo.cc>
Sorry! Extra code have slipped through. Removed duplicate of existing test. |
I think this should go to |
@samsonasik as a bugfix, targeting for a patch release: bugfixes are behaviour changes anyway 😁 |
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.
Thanks @Grundik!
Result#rewind()
calls
Description
Fixes #196.
BC break can occur if one deliberately used this bug as a feature. But that should not be the case in sane projects.