diff --git a/.travis.yml b/.travis.yml index 7ca571e707..15ce1738ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -157,15 +157,14 @@ before_install: fi if [[ $PHP = nightly ]]; then tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI - tfold ext.apcu install_apcu_dev 9c36db45100d4d27ec33072f4be90f1f5a0108b7 $INI else - tfold ext.apcu tpecl apcu-5.1.19 apcu.so $INI tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI tfold ext.redis tpecl redis-5.2.2 redis.so $INI "no" fi + tfold ext.apcu tpecl apcu-5.1.19 apcu.so $INI tfold ext.igbinary tpecl igbinary-3.1.6 igbinary.so $INI done - | diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 0bfe180464..aaf62d0267 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -175,7 +175,7 @@ class Filesystem if (!self::box('rmdir', $file) && file_exists($file)) { throw new IOException(sprintf('Failed to remove directory "%s": ', $file).self::$lastError); } - } elseif (!self::box('unlink', $file) && file_exists($file)) { + } elseif (!self::box('unlink', $file) && (false !== strpos(self::$lastError, 'Permission denied') || file_exists($file))) { throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError); } } diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index dcd6a393a9..68542d7b5c 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Filesystem\Tests; +use Symfony\Component\Filesystem\Exception\IOException; + /** * Test class for Filesystem. */ @@ -334,6 +336,28 @@ class FilesystemTest extends FilesystemTestCase $this->assertFileDoesNotExist($basePath.'dir'); } + public function testRemoveThrowsExceptionOnPermissionDenied() + { + $this->markAsSkippedIfChmodIsMissing(); + + $basePath = $this->workspace.\DIRECTORY_SEPARATOR.'dir_permissions'; + mkdir($basePath); + $file = $basePath.\DIRECTORY_SEPARATOR.'file'; + touch($file); + chmod($basePath, 0400); + + try { + $this->filesystem->remove($file); + $this->fail('Filesystem::remove() should throw an exception'); + } catch (IOException $e) { + $this->assertStringContainsString('Failed to remove file "'.$file.'"', $e->getMessage()); + $this->assertStringContainsString('Permission denied', $e->getMessage()); + } finally { + // Make sure we can clean up this file + chmod($basePath, 0777); + } + } + public function testRemoveCleansInvalidLinks() { $this->markAsSkippedIfSymlinkIsMissing(); diff --git a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php index 23e64690ef..dbfba52da8 100644 --- a/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php +++ b/src/Symfony/Component/HttpClient/Tests/HttpClientTestCase.php @@ -243,6 +243,14 @@ abstract class HttpClientTestCase extends BaseHttpClientTestCase sleep('\\' === \DIRECTORY_SEPARATOR ? 10 : 1); if (!$process->isRunning()) { + if ('\\' !== \DIRECTORY_SEPARATOR && 127 === $process->getExitCode()) { + self::markTestSkipped('vulcain binary is missing'); + } + + if ('\\' !== \DIRECTORY_SEPARATOR && 126 === $process->getExitCode()) { + self::markTestSkipped('vulcain binary is not executable'); + } + self::markTestSkipped((new ProcessFailedException($process))->getMessage()); }