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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

[error] forTemplate()


Go to End


2 Posts   953 Views

Avatar
darianno

Community Member, 14 Posts

30 July 2015 at 10:13pm

Edited: 31/07/2015 12:43am

Hello!

I've moved SilverStripe CMS from Linux server to Windows, and now sometimes I'm getting this error, and I don't know why:

PHP Fatal error: Call to a member function forTemplate() on a non-object in C:\www\mydomain.com\framework\admin\code\LeftAndMain.php on line 582.

I'm using CMS and Framework 3.1.6.

What could cause this error?

Thanks!

Avatar
Pyromanik

Community Member, 419 Posts

30 July 2015 at 10:26pm

Edited: 30/07/2015 10:33pm

Pretty much exactly what the error says: A non-object where an object is expected.
eg.

$obj = false;
$obj->forTemplate();

I imagine getEditForm is returning something unexpected (ie, not a Form) for some reason. http://api.silverstripe.org/3.1/source-class-LeftAndMain.html#582