[BUGFIX] Type checking at PageRepository::getFileReferences() call 80/36480/7
authorAlina Fleser <afleser@arxia.com>
Fri, 30 Jan 2015 22:17:25 +0000 (00:17 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 2 Jun 2015 21:24:25 +0000 (23:24 +0200)
Verification of parent element ($element) type before
PageRepository::getFileReferences() call
in FilesContentObject::handleFileReferences
to avoid PHP error in case of null value

Resolves: #64239
Resolves: #62616
Releases: master, 6.2
Change-Id: I8b89710af97eb37eee9518392e89ddeceb5b9f57
Reviewed-on: http://review.typo3.org/36480
Reviewed-by: Frank N├Ągler <typo3@naegler.net>
Tested-by: Frank N├Ągler <typo3@naegler.net>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php

index 56c0c34..e5c5f2c 100644 (file)
@@ -322,13 +322,14 @@ class FilesContentObject extends AbstractContentObject {
                        }
                }
 
-               $references = $pageRepository->getFileReferences(
-                       $referencesForeignTable,
-                       $referencesFieldName,
-                       $element
-               );
-
-               $this->addToArray($references, $fileObjects);
+               if (is_array($element)) {
+                       $references = $pageRepository->getFileReferences(
+                               $referencesForeignTable,
+                               $referencesFieldName,
+                               $element
+                       );
+                       $this->addToArray($references, $fileObjects);
+               }
        }
 
        /**