[BUGFIX] Unset file properties after signals are triggered 68/53568/2
authorHelmut Hummel <typo3@helhum.io>
Sun, 16 Jul 2017 18:06:23 +0000 (20:06 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Mon, 24 Jul 2017 06:27:38 +0000 (08:27 +0200)
Unsetting file properties needs to happen AFTER
the storage deleted the file, because the storage emits a signal,
which passes the file object to the slots,
which may need all file properties of the deleted file.

Resolves: #81926
Related: #80359
Releases: master, 8.7, 7.6
Change-Id: Ie8e25b30dd99d1ed2afb8ca7b1cc83797887de98
Reviewed-on: https://review.typo3.org/53568
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/Resource/AbstractFile.php

index f90321c..48694b5 100644 (file)
@@ -439,7 +439,15 @@ abstract class AbstractFile implements FileInterface
     public function delete()
     {
         // The storage will mark this file as deleted
-        return $this->getStorage()->deleteFile($this);
+        $wasDeleted = $this->getStorage()->deleteFile($this);
+
+        // Unset all properties when deleting the file, as they will be stale anyway
+        // This needs to happen AFTER the storage deleted the file, because the storage
+        // emits a signal, which passes the file object to the slots, which may need
+        // all file properties of the deleted file.
+        $this->properties = [];
+
+        return $wasDeleted;
     }
 
     /**