When presets is enabled the following error is generated (domain name excluded):
Fatal error: Cannot use object of type stdClass as array in \sites\all\modules\presets\presets.module on line 74
Searching around it seems the cause of this is an empty array, but I don't have the knowledge to pursue a solution.
If it makes a difference, I am using Pressflow 6.20.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | presets.jpg | 185.52 KB | LGLC |
Comments
Comment #1
LGLC commentedI get the same error. With Presets installed, crucial pages of my site become inaccessible (like the module page, the page to flush the cache etc.) - the only way to get back in is to use drush to disable Presets. I'm marking this as critical.
After some debugging the issue seems to lie with
presets_get_presetsreturning an incorrect set of results (the error message indicates that it's returning at least one Object instead of just arrays). I had a look through dsm to see what 'presets' were being picked up. I hadn't set up any presets using Presets (I couldn't get past the install!), but it seemed to have picked up some of my Features, specifically those from ImageCache, Views and OpenLayers (see attachment). So it seems to me as if this function is incorrectly picking up what it thinks are presets, when they're not (at least not in the format the Presets module would save them).I don't know if this is a bit of a hack, but I changed
presets_get_presetsto the following to ensure only arrays (and only those with the 'version' element) are returned.Note that if you've already installed Presets, it seems (and I don't understand the mechanisms behind this) that you need to change the function definition to
function presets_get_presets($reset = TRUE)(i.e. change $reset to TRUE) for the first time this function is called. (Change it to TRUE, then clear the cache, then you can change it back to FALSE and it seems to work fine from then on).Once I did this, I was able to clear the cache through drush without any errors and could then access /admin/build/modules.
I'll leave the issue open in hope that someone could step in and explain what's really going on and whether this is an okay workaround or whether it has any impact on the module. I'm only using Presets so that SEO Tools runs, so hopefully it should be okay.
Thanks.
Comment #2
LGLC commentedOkay it looks like my changes completely break the Presets admin page, so don't use them!
Comment #3
LGLC commentedActually it seems ok. After clearing the cache a few times I can get to /admin/presets/seotools. I can't see anything on /admin/presets but it appears that function calls a block of some sort and I have Panels Everywhere installed, which disables all blocks in the theme, so this could be the reason why.
Comment #4
Anonymous (not verified) commentedSame error, it completely broke my site...
Mysql 5.1.57 Drupal 6.22 php 5.2.17
I was trying to enable the seo module and its dependencies...
Comment #5
BrockBoland commentedThe problem is that it's invoking
hook_presets(), which tries to callmodulename_presets()on every module that's enabled. However, modules like ImageCache already define that function (in this case,imagecache_presets()) for their own use - it's a namespacing issue.Since this happens in several other modules that have much larger usage stats, trying to get them to change won't be a good way to solve this.
I propose renaming
hook_presets()to something likehook_presets_preset_list()—that is, the module name plus the intended action—to ensure that it won't conflict with existing modules.However, a change like this will require an update to any other modules that depend on Presets. For example,
seotools_presets()would need to be renamed toseotools_presets_preset_list(). This will be a problem if the user updates Presets but not the modules that rely on it (or vice versa). I'm not sure how best to handle this: simultaneous releases of updates, definingseotools_presets_preset_list()right in the Presets module to call the oldseotools_presets().Comment #6
CraigBertrand commentedI am having the same issue. I suppose I cannot use seotools until it is fixed. I don't know php or I would write a patch for both modules. If someone who does know php could submit a patch to both at least we could apply them until the releases get synchronized with the new namespace.
Would this be as simple as find and replace, or is it more complected than that?
Thanks a ton for this module. I can wait to use it via seotools.
Craig
Comment #7
CraigBertrand commentedCreated an issue on the seotools page as well
http://drupal.org/node/1310962