From 3b6a9579d44effc8c1fbe94ad5ab94bf27c33090 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 10 Jan 2011 21:55:44 +0000 Subject: [PATCH] BUGFIX #6304 PageCommentInterface::PostCommentForm() loads inappropriate data from cookie, including wrong values for ParentID git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@115399 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/sitefeatures/PageCommentInterface.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index 9d996dd0..84568ec8 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -216,8 +216,13 @@ class PageCommentInterface extends RequestHandler { $this->extend('updatePageCommentForm', $form); // Load the users data from a cookie - if($cookie = Cookie::get("PageCommentInterface_Data")) { - $form->loadDataFrom(unserialize($cookie)); + $cookie = Cookie::get('PageCommentInterface_Data'); + if($cookie) { + $visibleFields = array(); + foreach($fields as $field) { + if(!$field instanceof HiddenField) $visibleFields[] = $field->Name(); + } + $form->loadDataFrom(unserialize($cookie), false, $visibleFields); } return $form;