From: Michael Wallner Date: Sat, 28 Mar 2015 07:11:10 +0000 (+0100) Subject: fix for php-5.5 X-Git-Tag: v3.0.0~10 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=19ed5a5524fc2a2ed31e6c264ffbd0250027982d;p=pharext%2Fpharext fix for php-5.5 --- diff --git a/src/pharext/Task/Cleanup.php b/src/pharext/Task/Cleanup.php index 1263bd9..c2cfefa 100644 --- a/src/pharext/Task/Cleanup.php +++ b/src/pharext/Task/Cleanup.php @@ -26,14 +26,17 @@ class Cleanup implements Task * @param bool $verbose */ public function run($verbose = false) { - if (is_dir($this->rm)) { + if ($this->rm instanceof Tempfile) { + unset($this->rm); + } elseif (is_dir($this->rm)) { $rdi = new RecursiveDirectoryIterator($this->rm, - FilesystemIterator::CURRENT_AS_PATHNAME | + FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5 + FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::SKIP_DOTS); $rii = new RecursiveIteratorIterator($rdi, RecursiveIteratorIterator::CHILD_FIRST); - foreach ($rii as $path) { - if ($rii->isDir()) { + foreach ($rii as $path => $child) { + if ($child->isDir()) { rmdir($path); } else { unlink($path);