[BUGFIX] Exception when deleted file is in clipboard 91/18191/2
authorAndreas Wolf <andreas.wolf@typo3.org>
Sun, 10 Feb 2013 17:10:54 +0000 (18:10 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 13 Mar 2013 19:10:52 +0000 (20:10 +0100)
When a file is deleted while it is part of a clipboard, an exception is
thrown when the clipboard is reconstituted. This exception has to be
catched, otherwise the file module will be unusable.

Change-Id: I8849644ffa7b78559c1797d85ce3cc6e01d03a74
Resolves: #43906
Releases: 6.1, 6.0
Reviewed-on: https://review.typo3.org/18191
Reviewed-by: Thomas Scheibitz
Tested-by: Thomas Scheibitz
Reviewed-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/backend/Classes/Clipboard/Clipboard.php

index 4cf7fd1..fbd30b3 100644 (file)
@@ -744,9 +744,16 @@ class Clipboard {
                                                $this->changed = 1;
                                        }
                                } else {
-                                       if (!$v || \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($v) === NULL) {
+                                       if (!$v) {
                                                unset($this->clipData[$this->current]['el'][$k]);
                                                $this->changed = 1;
+                                       } else {
+                                               try {
+                                                       \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($v);
+                                               } catch (\RuntimeException $e) {
+                                                       // The file has been deleted in the meantime, so just remove it silently
+                                                       unset($this->clipData[$this->current]['el'][$k]);
+                                               }
                                        }
                                }
                        }