Skip to content
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

GroupedSelection: Rows are refetched after emptyResultSet call [Closes #15] #53

Closed
wants to merge 1 commit into from
Closed

GroupedSelection: Rows are refetched after emptyResultSet call [Closes #15] #53

wants to merge 1 commit into from

Conversation

hranicka
Copy link
Contributor

This is EXPERIMENTAL hotfix for very annoying Issue #15.

I can't reproduce the bug. It occurs only sometimes after app deploy & cache clean.

Maybe the problem is that Selection::emptyResultSet unsets $rows property.
It's OK because Selection::execute is called before work with the property and when is not set it will be created and it will be an array.

But in some places there are iterations over it and it reproduces an error.
(On another places there is foreach ((array) $this->rows ...) and I can't understand Nette\Database so deeply to make more changes in the code.)

I didn't understand why the error is thrown (see #15).
Now I've tried do anything else. In GroupedSelection the method ::execute is overriden.
But it doesn't write $rows property itself. Now I see it calls parent::execute but it's not called when some cache key is set.

So I think it can be the problem here with GroupedSelection.

  1. Selection::emptyResultSet sets $this->rows = NULL.
  2. GroupedSelection::execute doesn't call parent::execute and $rows property is null even after it has been called.
  3. Now we are in invalid state on some places ($rows property is NULL but we use it in foreach cycles or array access).

What do you think about it?
I muset wait few days or weeks if error will be away or not but as I've said - I can't reproduce the bug intentionally 😢

@hranicka
Copy link
Contributor Author

Mmm, it's not the right way... I'm completely wrong.

@hranicka
Copy link
Contributor Author

Sorry. I was trying write test case on the original code but really, I can't reproduce the bug neither after several hours.

It looks like a problem with corrupted cache, invalid cached state or I don't know.
I'm closing this PR which isn't the solution (and generates more SQLs).

@hranicka hranicka closed this Feb 20, 2015
@hranicka hranicka deleted the hotfix/invalid-foreach branch February 20, 2015 09:22
@hrach
Copy link
Contributor

hrach commented Feb 20, 2015

If you have the corrupted cache file, try to upload it somewhere and attach to the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants