[BUGFIX] No exceptions in GeneralUtility::rmdir 17/40917/2
authorAlexander Opitz <opitz.alexander@googlemail.com>
Fri, 3 Jul 2015 12:47:14 +0000 (14:47 +0200)
committerNicole Cordes <typo3@cordes.co>
Fri, 3 Jul 2015 20:54:19 +0000 (22:54 +0200)
The API returns TRUE on success and FALSE if something went wrong.
So we need to prevent that the ErrorHandler comes up, as it throws
Core\Error exceptions.

Resolves: #67897
Releases: master, 6.2
Change-Id: I2912241dd3c9a1b9928b4449ebc16897699fa9b5
Reviewed-on: http://review.typo3.org/40917
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Classes/Utility/GeneralUtility.php

index 8115e70..0e3e136 100755 (executable)
@@ -2900,7 +2900,7 @@ Connection: close
                if (file_exists($path)) {
                        $OK = TRUE;
                        if (!is_link($path) && is_dir($path)) {
-                               if ($removeNonEmpty == TRUE && ($handle = opendir($path))) {
+                               if ($removeNonEmpty == TRUE && ($handle = @opendir($path))) {
                                        while ($OK && FALSE !== ($file = readdir($handle))) {
                                                if ($file == '.' || $file == '..') {
                                                        continue;
@@ -2913,14 +2913,14 @@ Connection: close
                                        $OK = @rmdir($path);
                                }
                        } elseif (is_link($path) && is_dir($path) && TYPO3_OS === 'WIN') {
-                               $OK = rmdir($path);
+                               $OK = @rmdir($path);
                        } else {
                                // If $path is a file, simply remove it
-                               $OK = unlink($path);
+                               $OK = @unlink($path);
                        }
                        clearstatcache();
                } elseif (is_link($path)) {
-                       $OK = unlink($path);
+                       $OK = @unlink($path);
                        clearstatcache();
                }
                return $OK;