[BUGFIX] Allow Extbase FileReference in ImageService 67/60567/2
authorSusanne Moog <susanne.moog@typo3.com>
Fri, 26 Apr 2019 10:35:28 +0000 (12:35 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Fri, 3 May 2019 03:42:36 +0000 (05:42 +0200)
While hardening the ImageService it was restricted to core's
FileReference instead of also allowing extbase FileReferences - the
code for converting them is still there but not reachable anymore due
to the restrictive type hint.

Resolves: #88221
Releases: master
Change-Id: Id6c2ef70182f33cd28d13b4ffba7a8796548ff25
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60567
Tested-by: Ralf Zimmermann <ralf.zimmermann@tritum.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benjamin Kott <benjamin.kott@outlook.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Ralf Zimmermann <ralf.zimmermann@tritum.de>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/extbase/Classes/Service/ImageService.php

index c16a746..38512b1 100644 (file)
@@ -116,13 +116,13 @@ class ImageService implements \TYPO3\CMS\Core\SingletonInterface
      * It should be removed once we do not support string sources for images anymore.
      *
      * @param string $src
-     * @param FileInterface|null $image
+     * @param FileInterface|\TYPO3\CMS\Extbase\Domain\Model\FileReference|null $image
      * @param bool $treatIdAsReference
      * @return FileInterface
      * @throws \UnexpectedValueException
      * @internal
      */
-    public function getImage(string $src, ?FileInterface $image, bool $treatIdAsReference): FileInterface
+    public function getImage(string $src, $image, bool $treatIdAsReference): FileInterface
     {
         if ($image === null) {
             $image = $this->getImageFromSourceString($src, $treatIdAsReference);