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.

Blog Module /

Discuss the Blog Module.

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

Blog comment error


Reply


6 Posts   2545 Views

Avatar
Monty

Community Member, 19 Posts

30 November 2010 at 1:23pm

Version: 2.4.3
Module: blog-v0.4.1

I have installed the blog module and it works fine until after I post a comment on one of the blog posts. When I try to view the post from the blog holder page I get this error (see below). If I go Firefox > Tools > Clear Recent History > Clear Now I then am able to view the comments again until after the next comment is posted.

Your help is appreciated.

[Notice] unserialize() [function.unserialize]: Error at offset 5 of 254 bytes

211          Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
212          Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js');
213          Requirements::javascript(CMS_DIR . '/javascript/PageCommentInterface.js');
214       }
215       
216       $this->extend('updatePageCommentForm', $form);
217       
218       // Load the users data from a cookie
219       if($cookie = Cookie::get("PageCommentInterface_Data")) {
220          $form->loadDataFrom(unserialize($cookie));
221       }
222
223       return $form;
224    }
225    
226    function Comments() {

* unserialize(a:7:{s:3:\"url\";s:39:\"/blog/test/PageComments/PostCommentForm\";s:8:\"ParentID\";s:1:\"8\";s:4:\"Name\";s:4:\"Test\";s:12:\"CommenterURL\";s:4:\"test\";s:10:\"SecurityID\";s:9:\"850118868\";s:4:\"ajax\";s:1:\"1\";s:18:\"action_postcomment\";s:1:\"1\";})
Line 220 of PageCommentInterface.php
* PageCommentInterface->PostCommentForm()
Line 369 of ViewableData.php
* ViewableData->obj(PostCommentForm,,,1,)
Line 411 of ViewableData.php
* ViewableData->cachedCall(PostCommentForm,)
Line 424 of ViewableData.php
* ViewableData->hasValue(PostCommentForm)
Line 12 of .cache.cms.templates.PageCommentInterface.ss
* include(/private/var/folders/7y/7y2o8yaMGAyXsyfy+DACNE+++TI/-Tmp-/silverstripe-cache-Users-david-Documents-Freelance-Clients-David-Montgomery-David-Kelly-08-www/.cache.cms.templates.PageCommentInterface.ss)
Line 420 of SSViewer.php
* SSViewer->process(PageCommentInterface)
Line 342 of ViewableData.php
* ViewableData->renderWith(PageCommentInterface)
Line 129 of PageCommentInterface.php
* PageCommentInterface->forTemplate()
Line 447 of ViewableData.php
* ViewableData->XML_val(PageComments,,1)
Line 271 of .cache.blog.templates.Layout.BlogEntry.ss
* include(/private/var/folders/7y/7y2o8yaMGAyXsyfy+DACNE+++TI/-Tmp-/silverstripe-cache-Users-david-Documents-Freelance-Clients-David-Montgomery-David-Kelly-08-www/.cache.blog.templates.Layout.BlogEntry.ss)
Line 420 of SSViewer.php
* SSViewer->process(BlogEntry_Controller,Zend_Cache_Frontend_Output)
Line 411 of SSViewer.php
* SSViewer->process(BlogEntry_Controller)
Line 202 of Controller.php
* Controller->handleAction(SS_HTTPRequest)
Line 137 of RequestHandler.php
* RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
* Controller->handleRequest(SS_HTTPRequest)
Line 199 of ContentController.php
* ContentController->handleRequest(SS_HTTPRequest)
Line 184 of ContentController.php
* ContentController->handleRequest(SS_HTTPRequest)
Line 67 of ModelAsController.php
* ModelAsController->handleRequest(SS_HTTPRequest)
Line 281 of Director.php
* Director::handleRequest(SS_HTTPRequest,Session)
Line 124 of Director.php
* Director::direct(/blog/test/)
Line 127 of main.php

Avatar
Monty

Community Member, 19 Posts

30 November 2010 at 7:34pm

I think I worked this out:

in the php.ini file magic quotes needs to be off. My Mamp installation had them 'On'

magic_quotes_gpc = Off

Correct me if I`m wrong.

Cheers,
David

Avatar
Willr

Forum Moderator, 5513 Posts

30 November 2010 at 8:41pm

Good to hear disabling magic_quotes_gpc fixed it. I've added a note to the server requirements.

Thanks

Avatar
SheaDawson

Community Member, 46 Posts

7 February 2011 at 12:42am

Thanks for posting your solution, could have been stuck on this problem for ages... Cheers!

Avatar
JonoM

Community Member, 103 Posts

17 April 2011 at 11:31am

Helped me a lot too, thanks! On my shared hosting setup I added a php.ini file in to the Sapphire directory which contained the one line 'magic_quotes_gpc = Off' and everything seems to be working now. Cheers

Avatar
Anatol

126 Posts

23 June 2011 at 11:51am

Thanks for this thread. I also suddenly had an error message Form::loadDataFrom() not passed an array or an object on any page with page comments enabled. Clearing the browser cookies or using another browser solved it until I posted the next comment. The issue must have been the commenter name that's stored in a cookie.

As mentioned above magic_quotes_gpc = Off fixes the problem.

magic_quotes_gpc was turned on accidentally because I made a mistake in another part of the php.ini file (I accidentally added a character into the php.ini file where it shouldn't be) and magic_quotes_gpc defaulted to "On", even though in the ini file it was set to "Off".

Just in case anyone else has the same problem.

magic_quotes_gpc is deprecated as of PHP 5.3.0, so it should be safe to get rid of it.

This also reminds me that I should make a backup of my php.ini before I make some changes...