-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
ActiveRow: Trying to get property of non-object & Selection: Invalid argument supplied for foreach() #15
Comments
@hranicka Sadly, I really need the reproducible usecase. On forum you have written that it appears, if .... -> so is it reproducible on your project, but you can it reproduce on sandbox? Would you accept sending privately your project with the bug to my email? |
I have same problem. After cleaning temp dir first page render is ok, refresh throw this error and next refresh fix it to next cleaning temp dir. Error is throwing code:
and error is throwing {var $url = 'FB-'.$photo->url} even if it pass through if(is_object()) |
I think I have encountered something similar while back. I found out that in cache was incomplete row from partial select and on full select that cache was used leaving some properties empty. |
@hrach is finer caching granularity correct fix for this issue? Partial row should re-execute query and not to throw error. |
@dg yes, definitelly not, however, fi they weren't able to reproduci it untill now, I thing there will never be. |
@hranicka It would be awesome If you be able to reproduce it. No, it's not the test for that...it's just rewritten old one. |
@hrach I'm trying evoke the bug in simple situation in nette/sandbox v2.2.2 but there it works fine. It's really strange :( I'll try it again later with more comlex DB structure. Until I can't help more, because I can't reproduce the bug on simple project when I need... it maybe appears only in some situations on larger projects :( During week I'll try create a buggy environment in nette/sandbox, but I'm sceptic that I succeed. But hope... |
@hranicka thanks! :) |
@hrach So I've tried envoke the bug on nette/sandbox v2.2.2 with custom DB structures but everything worked fine. Sorry, I can't reproduce test case for the bug when I need :( |
@hranicka that's the sad story... the system is quite complex and I believe I have fiexed almost everything what I could fixed :) |
I got it! Or no? ... See:
And maybe the core of the problem GroupedSelection!
What is the purpose of For the current implementation I use fix like this: // Nette\Database\Table\Selection
public function offsetGet($key)
{
$this->execute();
// solves strange cache bug
if ($this->rows === NULL) {
$this->cache = NULL;
return $this->data[$key];
}
return $this->rows[$key];
} It helps in most cases (first problem). But maybe right way for the fix can be overriden I can try fix the problem, but can you please explain me differences between |
One holds all fetched rows, the second holds aggregated rows (makes sence only in context of GroupedSelection) |
Very strange problem. I've spent several hours and I can't still reproduce the bug purposely :( I will try reproduce it maybe later again. |
For the first HTTP request the error is produced but for the next request everything works fine. I'll try conditionally copy cached files immediatelly when error occurs and again try to find the problem. It may take some time. |
This (#15 (comment)) seems to have solved the issue for me:
|
@dg I don't like 3c44de6 nowadays 😞 Sorry for that.
3c44de6 solves only the @dg @temistokles For last few weeks I use another and more clear fix: #59 @temistokles Can you try #59 please instead of the ugly "offsetGet workaround"? We use it on several projects where previous solution (3c44de6) wasn't enough. |
I have applied the code as well (before trying the fix above) and it did not work by itself. Because I cannot reproduce this issue anymore at the moment, I am not sure if the patch to GroupedSelection was critical or not (anyway the problematic query does not use any grouping). |
This issue could be related to #115, because this mainly happens on heavy-traffic, not in testing environments, the multiple accesses to the "same" data could be the key. Also I confirm the issue is still present, although not that often in my case, as before. |
In some cases (delete of cache files, access to one page and then access to another page)
Nette\Database\Table\ActiveRow::accessColumn
generates Notice.I can't write test case because bug is unpredictable.
My temporary solution is edit
Nette\Database\Table\Selection::offsetGet
, but it's only a hack IMHO (and is applied only to ::offsetGet).Another hack is edit
Nette\Database\Table\ActiveRow::accessColumn
like this:Related topic in forum:
I can't reproduce issue artifically so I can't write tests and create full pull-request at the moment :(
Codes above are only my "hacks" until we found right cause of the issue.
The text was updated successfully, but these errors were encountered: