-
MODX Staff
- 10,725 Posts
Yes, Snippets and Plugins are cached by those ID's as global function definitions. You can look at the code in the file for the line specified to see what is triggering the error.
Many thanks, the plot thickens on this one ...
Could the front-end Fatal Error message, with id 27, be 'cross-referencing' an error log message with snippet id 28 ? or is that simply not possible - ie the php Fatal Error message is completely unambiguous and only references one snippet?
-
MODX Staff
- 10,725 Posts
I'm a little lost on what you are asking; where does the snippet with id 28 come in to play here?
Look in the core/cache/elements/modsnippet directory and find the snippet with number 27.
The odds are excellent that around line 73 of that file will be a call to the get() method of an object that a previous function failed to retrieve (most likely getObject() or getCollection() ).
You should always test for the existence of an object retrieved with one of the get*() functions like getObject() or getCollection() before calling their get() method.
<?php
$object = $modx->getObject(whatever);
if ($object) {
$var = $object->get('field-name');
}
opengeek: Sorry that was a bit wooly, more clearly I meant that there's a snippet id 28 showing in the error log, which is the only error there, and I wondered if there could be any correlation tween the php fatal error msg and the .error log msg.
BobRay - I'll have a look at this but it'll have to wait a little, will reply when done.
Thanks all
Most likely, you also have a problem (maybe the same one -- depending on the error message) in the snippet with the ID of 28.
Also, some clarification on my message. What I described will help you *find* the error. Of course to fix it, you have to edit the snippet itself, not the cache file.
Fixed, emptying the site cache cleared the whole problem.
I'll look further into it but thanks for the replies
It will come back if there's some situation where that snippet fails to get the object it's looking for.
Feel free to post the DB-related code in the two snippets.