From c8c00bec85af08e1114ac800698f55429972dd1d Mon Sep 17 00:00:00 2001 From: Iltar van der Berg Date: Fri, 4 Jan 2013 12:28:25 +0100 Subject: [PATCH 1/2] Fix to prevent touch from failing if it already exists but made by another user when atime is not used --- src/Symfony/Component/Filesystem/Filesystem.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index af26ef4c6f79d..04e635def3a56 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -100,10 +100,6 @@ public function exists($files) */ public function touch($files, $time = null, $atime = null) { - if (null === $time) { - $time = time(); - } - foreach ($this->toIterator($files) as $file) { if (true !== @touch($file, $time, $atime)) { throw new IOException(sprintf('Failed to touch %s', $file)); From 752dbf0a6b29d0cc111f1aade183a8c94159bf44 Mon Sep 17 00:00:00 2001 From: Iltar van der Berg Date: Fri, 4 Jan 2013 12:46:39 +0100 Subject: [PATCH 2/2] Small update regarding previous commit --- src/Symfony/Component/Filesystem/Filesystem.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 04e635def3a56..877ba9e842e58 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -101,7 +101,8 @@ public function exists($files) public function touch($files, $time = null, $atime = null) { foreach ($this->toIterator($files) as $file) { - if (true !== @touch($file, $time, $atime)) { + $touch = $time ? @touch($file, $time, $atime) : @touch($file); + if (true !== $touch) { throw new IOException(sprintf('Failed to touch %s', $file)); } }