From 1a46ea9b1371f864d701085376d215d9df1bc3ac Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Sat, 17 Jun 2017 23:47:08 +0200 Subject: [PATCH] Remove bogus array_filter to allow 0 as directory name --- lib/EioDriver.php | 2 +- lib/UvDriver.php | 2 +- test/DriverTest.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/EioDriver.php b/lib/EioDriver.php index 656c87a..133cbac 100644 --- a/lib/EioDriver.php +++ b/lib/EioDriver.php @@ -394,7 +394,7 @@ class EioDriver implements Driver { if ($recursive) { $path = str_replace("/", DIRECTORY_SEPARATOR, $path); - $arrayPath = array_filter(explode(DIRECTORY_SEPARATOR, $path)); + $arrayPath = explode(DIRECTORY_SEPARATOR, $path); $tmpPath = ""; $callback = function () use ( diff --git a/lib/UvDriver.php b/lib/UvDriver.php index 7ba0dcf..f8d838e 100644 --- a/lib/UvDriver.php +++ b/lib/UvDriver.php @@ -352,7 +352,7 @@ class UvDriver implements Driver { if ($recursive) { $path = str_replace("/", DIRECTORY_SEPARATOR, $path); - $arrayPath = array_filter(explode(DIRECTORY_SEPARATOR, $path)); + $arrayPath = explode(DIRECTORY_SEPARATOR, $path); $tmpPath = ""; $callback = function () use ( diff --git a/test/DriverTest.php b/test/DriverTest.php index 451f097..fb77486 100644 --- a/test/DriverTest.php +++ b/test/DriverTest.php @@ -230,7 +230,8 @@ abstract class DriverTest extends TestCase { yield File\rmdir($dir); $this->assertNull(yield File\stat($dir)); - $dir = "{$fixtureDir}/newdir/with/recursive/creation"; + // test for 0, because previous array_filter made that not work + $dir = "{$fixtureDir}/newdir/with/recursive/creation/0/1/2"; yield File\mkdir($dir, 0764, true); // the umask is 022 by default $stat = yield File\stat($dir);