PHP Fatal error: Cannot unset string offsets in GalleryUtilities.class
algurgazan
Joined: 2007-02-22
Posts: 5 |
Posted: Thu, 2009-01-01 22:55 |
For some reason my gallery isn't working like it should in my embedded environment... It's embedded in a CMS called subdreamer through a lousy plugin I had to tinker with to get it started, and it worked just fine.. I got some (unrelated) problems with permissions and had to reinstall, and now I've run into another problem: when I'm logged in in the CMS (which goes through SMF btw, but i don't think that matters to gallery 'cause it has nothing to do with it, goes through the CMS first) gallery gets PHP to throw the error in the subject: PHP Fatal error: Cannot unset string offsets in ///public_html/gallery2/modules/core/classes/GalleryUtilities.class on line 387 Strange thing is that it doens't happen all the time, and that it happens the most (but not always) when a user is logged in, and doesn't seem to happen when not logged in.. It also doesn't happen when the gallery is accessed directly.. Site url: http://solagratiazeist.nl |
|
Posts: 32509
the code in question:
http://fisheye3.atlassian.com/browse/gallery/trunk/gallery2/modules/core/classes/GalleryUtilities.class?r=17582#l387
googling for the error yields:
http://drupal.org/node/105316
http://bugs.php.net/bug.php?id=31303
doesn't help much. the question is why / where is GalleryUtilities::removeRequestVariable() called with a wrong $key.
quick fix:
change line 387 of modules/core/classes/GalleryUtilities.class from:
unset($array[$key]);
to:
if (is_array($array)) unset($array[$key]);
personally, i'd also add an else case to log the call stack which led to that invalid call.
at the top of the function, add $originalArrayPath = $keyPath;
and at the bottom of the function:
if (is_array($array)) {
unset($array[$key]);
} else {
$ret = GalleryCoreApi::error(ERROR_BAD_PARAMETER, __FILE__, __LINE__, 'Array path: ' . print_r($originalArrayPath, true));
GalleryCoreApi::addEventLogEntry('Gallery Error', 'Unable to remove request variable', $ret->getAsText());
}
then you can go to g2's site admin -> event log, to see if there are any entries for that issue from time to time.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 5
thanks for the reply! i've made the changes you suggested, and i'm getting a really filled event log now.. this is the error:
Posts: 32509
weird, it says that $_POST is not an array.
does your integration (public_html/index.php, clearly/clearly_2.php, g2embed.php, ...) redefine $_POST? if so, it isn't doing it correctly.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage