From 3f2865b90fc10e6ab4b046951fa775f31e873865 Mon Sep 17 00:00:00 2001 From: Alessandro Desantis Date: Mon, 9 Apr 2012 20:56:50 +0200 Subject: [PATCH] [Filesystem] rename() throws RuntimeException on error (fixes #3848). --- src/Symfony/Component/Filesystem/Filesystem.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index a63c5a313f..8ddddadcac 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -136,7 +136,9 @@ class Filesystem throw new \RuntimeException(sprintf('Cannot rename because the target "%s" already exist.', $target)); } - rename($origin, $target); + if (false === rename($origin, $target)) { + throw new \RuntimeException(sprintf('Cannot rename "%s" to "%s".', $origin, $target)); + } } /**