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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

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

Patch: Fix error notice when calling Object::addStaticVars

Go to End

3 Posts   1949 Views


Google Summer of Code Hacker, 222 Posts

16 May 2007 at 4:08pm

I get the following error when adding a new item to the main Admin Menu with my module:

"Notice: Undefined index: LeftAndMain in /var/www/silverstripe/sapphire/core/Object.php on line 241"

This patch fixes the error by only merging the array of extraStatics[$class] if it is not empty:

Note: I'm not really sure what's going on here, except that this fixes the error without breaking things (that I know of), so you should double-check to make sure this patch makes sense. ;)

Here is the code I used for my new 'listings' module with this in listings/_config.php

global $project;
$project = 'listings';
Object::addStaticVars('LeftAndMain', array(
'extra_menu_items' => array(
'MyCustomInterface' => 'admin/listings/',
Director::addRules(100, array(
'admin/listings/$Action/$ID/$OtherID' => 'Listings',

Hope this helps,



Community Member, 231 Posts

28 May 2007 at 1:56pm

Applied, thanks.


Google Summer of Code Hacker, 222 Posts

31 May 2007 at 1:58pm

Hi Andy,

I've just updated to sapphire/trunk SVN revision 36273 and it doesn't seem that this patch has been applied.

Has it been applied somewhere else?