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.

Archive /

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

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

Patch: Fix errors when running db/build


Go to End


2250 Views

Avatar
elijahlofgren

Google Summer of Code Hacker, 222 Posts

24 May 2007 at 10:18am

Using the latest daily build, I get a bunch of error notices when I run db/build.
This patch fixes most of those errors:
http://www.elijahlofgren.com/silverstripe/patches/Fix-db-build-errors-silverstripe.2.0.DailyBuild.2007-05-23.patch

Explanation of changes:

1. First off, this patch fixes this error:
Notice: Undefined index: LeftAndMain in /var/www/silverstripe/sapphire/core/Object.php on line 241

The fix was in addStaticVars() to only merge Object::$extraStatics[$class] with $statics if it is not empty.

2. Next, it fixes repeated errors like this:

Notice: Use of undefined constant Datetime - assumed 'Datetime' in /var/www/silverstripe/sapphire/core/model/Database.php(67) : eval()'d code on line 1

It does this by adding the needed single quotes around the first parameter in statements like:
return Object::create('Datetime',$fieldName);

3. It also fixes a bunch of errors like this by just changing $field to $fieldName:

Notice: Undefined variable: field in /var/www/silverstripe/sapphire/core/model/DataObject.php on line 955

4. This patch does not fix the following error:
Notice: Undefined variable: surl in /var/www/silverstripe/sapphire/main.php on line 109

A fix for that error was posted by steki here: http://www.silverstripe.com/contributions/flat/1204

Hope this helps,

Elijah