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.

Archive

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

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

Patch: Fix errors when running db/build


Reply

2 Posts   1681 Views

Avatar
elijahlofgren

24 May 2007 at 10:18am Google Summer of Code Hacker, 222 Posts

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

Avatar
Andy

28 May 2007 at 2:26pm 230 Posts

Excellent, applied.