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.

Form Questions /

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

Problem with Silverstripe backend fatal error emssage


Go to End


8 Posts   1812 Views

Avatar
rsilvajls

Community Member, 7 Posts

19 February 2013 at 8:22am

I got a request from a client to fix a form on the website alsm.org. Apparently they stopped receiving the form inquiries. I logged into their backend and on every page I see this error.

Fatal error: Cannot redeclare class Form in /home/alsm_admin/alsm.org/www/sapphire/forms/Form.php on line 1289

Anyone can help me figure out the problem?

Thanks!

Avatar
swaiba

Forum Moderator, 1899 Posts

19 February 2013 at 8:36am

Edited: 19/02/2013 8:37am

Sure! Search your code base for "class Form" then remove the duplicate class (or probably rename it to something else)

Avatar
rsilvajls

Community Member, 7 Posts

19 February 2013 at 8:52am

I did try doing that but on that line there is only a closing bracket. This is toward the end of the entire code. And this all there is.

before that..there is only one time that class form is mentioned at the very beginning

/**
* Test an ajax submission of this form.
* @return SS_HTTPResponse the response object that the handling controller produces. You can interrogate this in your unit test.
*/
function testAjaxSubmission($action, $data) {
$data['ajax'] = 1;
return $this->testSubmission($action, $data);
}
}

/**
* @package forms
* @subpackage core
*/
class Form_FieldMap extends ViewableData {
protected $form;

function __construct($form) {
$this->form = $form;
parent::__construct();
}

/**
* Ensure that all potential method calls get passed to __call(), therefore to dataFieldByName
*/
function hasMethod($method) {
return true;
}

function __call($method, $args = null) {
return $this->form->Fields()->fieldByName($method);
}
}

Avatar
swaiba

Forum Moderator, 1899 Posts

19 February 2013 at 9:10am

that looks like silverstipe core code (i.e. from "sapphire" or "framework" folder) - you are looking for it within *your* code as I assume you are not hacking the core code... if you are you should strongly consider not doing so.

maybe you had it at one time and then it was removed, in which case a dev/build should sort it out

Avatar
rsilvajls

Community Member, 7 Posts

19 February 2013 at 9:22am

Hi, yes yes its exactly a "saphire" fodler code.

I have tried not touching anything yet. The worse part is that I am new to silverstripe and this is a site that someone else built alost 5 years ago. So I am trying to figure out what the problem is.

What exactly do you mean by a dev/build can help me sort this out? You mean like original core code that I can use to replace this one?

Avatar
swaiba

Forum Moderator, 1899 Posts

19 February 2013 at 9:45am

Sorry if "dev/build" doesn't mean anything to you I'll have say RTM! As that is a big question that is covered by doing the most basic of things... like the tutorials... it is covered several times in this video... http://vimeo.com/16842606

Avatar
rsilvajls

Community Member, 7 Posts

19 February 2013 at 10:47am

Thank you for all of your help. I have tried replacing the code and the core files of the sapphire framework and still get the same error message. I am sure that you know how frustrating it is to work on someone elses code. I am not even sure if this is the problem with the form. The website is working just fine. One of the contact forms is my problem.

Avatar
swaiba

Forum Moderator, 1899 Posts

19 February 2013 at 11:06am

stop looking for the item in sapphire now... search the ENTIRE webroot for "class Form" it could be anywhere.