Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

ImageGallery: Bad Class to Singleton


Go to End


1151 Views

Avatar
ssssteve

Community Member, 4 Posts

9 October 2010 at 10:41pm

(Reposted in the right forum!)

Hi,

Just added dataobjectmanager and imagegallery to my development site, and I'm getting an error

"ERROR [User Error]: Bad class to singleton() - ImageGalleryPage

Uploaded dataobjectmanager, did a dev/build/ and flush - no problems. Uploaded imagegallery, dev/build/ and flush, still OK. Created an ImageGalleryPage which was created, but navigating to it gives a blank error message window, sometimes accompanied by the following trace:

ERROR [User Error]: Bad class to singleton() - ImageGalleryPage
IN POST /silverstripe/admin/getitem?ID=34&ajax=1
Line 328 in /**(deleted)**/silverstripe/sapphire/core/Core.php

Source
======
319: *
320: * @param string $className
321: * @return Object
322: */
323: function singleton($className) {
324:    global $_SINGLETONS;
325:    if(!isset($className)) user_error("singleton() Called without a class", E_USER_ERROR);
326:    if(!is_string($className)) user_error("singleton() passed bad class_name: " .
var_export($className,true), E_USER_ERROR);
327:    if(!isset($_SINGLETONS[$className])) {
* 328:     if(!class_exists($className)) user_error("Bad class to singleton() - $className",
E_USER_ERROR);
329:       $_SINGLETONS[$className] = Object::strong_create($className,null, true);
330:       if(!$_SINGLETONS[$className]) user_error("singleton() Unknown class '$className'", E_USER_ERROR);
331:    }
332:    return $_SINGLETONS[$className];
333: }
334:

Trace
=====
<ul>user_error(Bad class to singleton() - ImageGalleryPage,256)
line 328 of Core.php

singleton(ImageGalleryPage)
line 312 of SiteTree.php

SiteTree::page_type_classes()
line 2204 of SiteTree.php

SiteTree->getClassDropdown()
line 1754 of SiteTree.php

SiteTree->getCMSFields(CMSMain)
line 438 of CMSMain.php

CMSMain->getEditForm(34)
line 1023 of LeftAndMain.php

LeftAndMain->EditForm()
line 384 of LeftAndMain.php

LeftAndMain->getitem(SS_HTTPRequest)
line 193 of Controller.php

Controller->handleAction(SS_HTTPRequest)
line 134 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.php

Controller->handleRequest(SS_HTTPRequest)
line 283 of Director.php

Director::handleRequest(SS_HTTPRequest,Session)
line 127 of Director.php

Director::direct(/admin/getitem)
line 127 of main.php

</ul>

It won't let me delete the page until I uninstall imagegallery, but after a reinstall it repeats the above. Help!