[BUGFIX] PHP Warning in HistoryService 87/37787/2
authorOliver Hader <oliver@typo3.org>
Wed, 11 Mar 2015 14:43:01 +0000 (15:43 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 12 Mar 2015 12:37:38 +0000 (13:37 +0100)
Using the workspace module in the backend might show warnings
concerning the HistoryService if no history is available for
a particular record.

Resolves: #65668
Releases: master, 6.2
Change-Id: I0a80d714c0633568d4ee4827adb7502601b75b6b
Reviewed-on: http://review.typo3.org/37787
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/History/RecordHistory.php
typo3/sysext/workspaces/Classes/Service/HistoryService.php

index 97c5994..76f1f17 100644 (file)
@@ -79,7 +79,7 @@ class RecordHistory {
        /**
         * @todo Define visibility
         */
-       public $changeLog;
+       public $changeLog = array();
 
        /**
         * @todo Define visibility
index 03775f4..ec2b88f 100644 (file)
@@ -55,7 +55,7 @@ class HistoryService implements \TYPO3\CMS\Core\SingletonInterface {
        public function getHistory($table, $id) {
                $history = array();
                $i = 0;
-               foreach ($this->getHistoryObject($table, $id)->changeLog as $entry) {
+               foreach ((array)$this->getHistoryObject($table, $id)->changeLog as $entry) {
                        if ($i++ > 20) {
                                break;
                        }