Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Blog comment error

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 2443 Views
  • Monty
    Community Member
    19 Posts

    Blog comment error Link to this post

    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       }
    216       $this->extend('updatePageCommentForm', $form);
    218       // Load the users data from a cookie
    219       if($cookie = Cookie::get("PageCommentInterface_Data")) {
    220          $form->loadDataFrom(unserialize($cookie));
    221       }
    223       return $form;
    224    }
    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

  • Monty
    Community Member
    19 Posts

    Re: Blog comment error Link to this post

    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.


  • Willr
    Forum Moderator
    5497 Posts

    Re: Blog comment error Link to this post

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


  • SheaDawson
    Community Member
    45 Posts

    Re: Blog comment error Link to this post

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

  • JonoM
    Community Member
    103 Posts

    Re: Blog comment error Link to this post

    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

  • Anatol
    126 Posts

    Re: Blog comment error Link to this post

    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...

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.