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

Installing Blog ontop of Tutorial (Fatal error)


Go to End


17 Posts   35798 Views

Avatar
Fuzz10

Community Member, 791 Posts

23 May 2008 at 9:16am

Hmmm. weird..

Just installed the blog (last daily build) on SS 2.2.2 , no problems...

Maybe it is something in your (hosting) setup ?

Avatar
civilis.biz

Community Member, 3 Posts

23 May 2008 at 12:57pm

I'm having the same "bad class to singleton()" problem as JonathanParker, getting the same traceback, but slightly different debug info. The error is below.

I am also new to SilverStripe. I downloaded the both the CMS and the Blog today so I have the latest "released" versions. One difference is that I am not installing over the tutorial, just the startup blackcandy theme. I am using a my windows machine as the server, using "localhost". The machine is running older versions of apache (2.0.55), mysql (5.0.18 win32), and Php (5.1.2.2).

I wonder if we have anything in common?

----------------------------

FATAL ERROR: Bad class to singleton() - BlogEntry
At line 85 in C:\Apache2\htdocs\silverstripe\sapphire\core\Core.php

user_error(Bad class to singleton() - BlogEntry,256)
line 85 of Core.php

singleton(BlogEntry)
line 175 of DatabaseAdmin.php

DatabaseAdmin->doBuild()
line 90 of DatabaseAdmin.php

DatabaseAdmin->build(Array)
line 261 of Controller.php

Controller->run(Array)
line 104 of Director.php

Director::direct(/db/build)
line 158 of main.php
Context
Debug (Debug::showError() in line 180 of Debug.php)

Notice: Trying to get property of non-object in C:\Apache2\htdocs\silverstripe\ecommerce-v0.5.2\code\Order.php on line 1077

* className =

BlogEntry

* _SINGLETONS =
o Member =
Database record: Member
+ ID :

0

o Newsletter =
Database record: Newsletter
+ ID :

0

o Newsletter_SentRecipient =
Database record: Newsletter_SentRecipient
+ ID :

0

o Newsletter_Recipient =
Database record: Newsletter_Recipient
+ ID :

0

o NewsletterType =
Database record: NewsletterType
+ ID :

0

o PageComment =
Database record: PageComment
+ ID :

0

o Order =
Database record: Order
+ ID :

0

o DataObject =
Database record: DataObject
+ ID :

0

o Order_Item =
Order Item Order_Item

Product:
Quantity:
UnitPrice:
Title:
OrderID:
ProductID:
ProductVersion:
o OrderStatusLog =
Database record: OrderStatusLog
+ ID :

0

o Payment =
Database record: Payment
+ ID :

0

+ IdentityURL :

+ ForumRank :

Community Member

+ Currency :

USD

+ IP :

127.0.0.1

+ MemberID :

1

o Product_Attribute =
Database record: Product_Attribute
+ ID :

0

o Post =
Database record: Post
+ ID :

0

o Post_Subscription =
Database record: Post_Subscription
+ ID :

0

o MemberLocation =
Database record: MemberLocation
+ ID :

0

o Email_BounceRecord =
Database record: Email_BounceRecord
+ ID :

0

o Email_BlackList =
Database record: Email_BlackList
+ ID :

0

o PageView =
Database record: PageView
+ ID :

0

o SiteTree =
Database record: SiteTree
+ ID :

0

o Translatable = Translatable::__set_state(array( 'translatableFields' => array ( 0 => NULL, 1 => true, 2 => NULL, 3 => NULL, 4 => NULL, 5 => NULL, 6 => NULL, 7 => NULL, 8 => NULL, ), 'original_values' => NULL, 'owner' => NULL, 'extension_instances' => array ( ), 'class' => 'Translatable', ))
o QueuedEmail =
Database record: QueuedEmail
+ ID :

0

o File =
Database record: File
+ ID :

0

o EditableCheckboxOption =
Database record: EditableCheckboxOption
+ ID :

0

o EditableDropdownOption =
Database record: EditableDropdownOption
+ ID :

0

o EditableFormField =
Database record: EditableFormField
+ ID :

0

o EditableRadioOption =
Database record: EditableRadioOption
+ ID :

0

o SubmittedForm =
Database record: SubmittedForm
+ ID :

0

o SubmittedFormField =
Database record: SubmittedFormField
+ ID :

0

o Group =
Database record: Group
+ ID :

0

o Member_UnsubscribeRecord =
Database record: Member_UnsubscribeRecord
+ ID :

0

o Permission =
Database record: Permission
+ ID :

0

o Widget =
Database record: Widget
+ ID :

0

o WidgetArea =
Database record: WidgetArea
+ ID :

0

o ChequePayment =
Database record: ChequePayment
+ ID :

0

+ IdentityURL :

+ ForumRank :

Community Member

+ Currency :

USD

+ IP :

127.0.0.1

+ MemberID :

1

o DPSPayment =
Database record: DPSPayment
+ ID :

0

+ IdentityURL :

+ ForumRank :

Community Member

+ Currency :

USD

+ IP :

127.0.0.1

+ MemberID :

1

o PayPalPayment =
Database record: PayPalPayment
+ ID :

0

+ IdentityURL :

+ ForumRank :

Community Member

+ Currency :

USD

+ IP :

127.0.0.1

+ MemberID :

1

o WorldpayPayment =
Database record: WorldpayPayment
+ ID :

0

+ IdentityURL :

+ ForumRank :

Community Member

+ Currency :

USD

+ IP :

127.0.0.1

+ MemberID :

1

o Order_Item_Attribute =
Database record: Order_Item_Attribute
+ ID :

0

o Page =
Database record: Page
+ ID :

0

o GhostPage =
Database record: GhostPage
+ ID :

0

Avatar
civilis.biz

Community Member, 3 Posts

23 May 2008 at 2:34pm

Edited: 23/05/2008 2:57pm

Got past this error. I will submit this bug and fix. Here is what to do.
1) Change line one of BlogEntry.php from:

<?

to:
<?php

2) Change line one of BlogHolder.php from:

<?

to:
<?php

When I made those changes, the database was successfully modified and the blog menu appeared. Unfortunately, clicking on the "blog" in the webpage now brings up:

XML Parsing Error: junk after document element
Location: http://localhost/silverstripe/blog/
Line Number 4, Column 1:<?xml version="1.0" encoding="UTF-8"?>
^

While I have not had a chance to look into this XML problem yet, I suspect the cause might be very similar....but it is late here and I am going to call it a night. If someone finds a fix to this second problem, please post it.

Avatar
JonathanParker

Community Member, 37 Posts

23 May 2008 at 9:16pm

Hi Dennis, It has been some time since I've had this problem and I should have really posted the solution at the time I found it so this is from memory:
The root of my problem was that I did not have PHP 'short tags' enabled within my WAMP 2.0 install and some of the php files within SS were using short tags i.e. <? code ?> as apposed to <?php code ?>.
What I suggest is that you check the offending source code files to see if any start with the short tag (<?) and replace it with (<?php )
You could also check to see if php short tags is enabled in your local install. If not then enable it and see if that cures the problem. If it does then you will need to check the source files as I have said above.
I opted for changing offending source files as I could not enable short tags on my live production server.

Hope this helps Dennis if you need any further assistance then please e-mail me jonathan@dabnis.com

Regards.

Jonathan

Avatar
Tim

Community Member, 201 Posts

23 May 2008 at 10:15pm

Looks like you've spotted the root of this problem, I'll see that this is patched in the main code base.

Avatar
civilis.biz

Community Member, 3 Posts

24 May 2008 at 2:49am

Edited: 24/05/2008 2:53am

XML Parsing Error: junk after document element 
Location: http://localhost/silverstripe/blog/ 
Line Number 4, Column 1:<?xml version="1.0" encoding="UTF-8"?> 
^ 

This error was caused by something different On line 118 in BBCodeParser.php, there appears the following line:

Debug::message($this->content);

If I comment out this line, the error goes away and the module appears to work. I don't know if this is just a stray debug message left in the code, or if commenting out this line is going to cause other problems down the line....(keeping fingers crossed!)

Avatar
NathanNZ

Community Member, 6 Posts

10 June 2008 at 9:52pm

Edited: 10/06/2008 9:52pm

Hi,

I ran into the same error having installed silverstripe 2.2.2 and the blog module ( v0.1) - I followed Jonathan's advice above and went into the WAMP server PHP settings and enabled the following setting:

PHP > PHP settings > "short open tag"

I then ran http://localhost/silverstripe-v2.2.2/db/build?flush=1 and this time the blog module install ran without errors.

Avatar
NathanNZ

Community Member, 6 Posts

10 June 2008 at 10:16pm

Also used the fix from civilis.biz above (thanks!) for the XML error. Depending on where you installed, BBCodeParser.php is located somewhere like this :

..\silverstripe-v2.2.2\sapphire\parsers\

change the line :

Debug::message($this->content);
to

/*Debug::message($this->content);*/