From e336ebeecf2f7e211a6d3a33e9ced8aa11029658 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 6 Apr 2018 17:41:22 +0200 Subject: [PATCH] Fixing GlobResource when inside phar archive When packaging an Sf4 application as a PHAR archive using globs at various locations (`Kernel`, `services.yaml`) most glob files are not found because the `glob()` PHP method [does not support PHAR streams](https://stackoverflow.com/questions/8203188/unexpected-problems-with-php-phar). Using the regex fallback instead when operating inside PHAR archives fixes the behavior for me. --- src/Symfony/Component/Config/Resource/GlobResource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Resource/GlobResource.php b/src/Symfony/Component/Config/Resource/GlobResource.php index 1edd7cd22e44a..95c6ac629f0d3 100644 --- a/src/Symfony/Component/Config/Resource/GlobResource.php +++ b/src/Symfony/Component/Config/Resource/GlobResource.php @@ -93,7 +93,7 @@ public function getIterator() return; } - if (false === strpos($this->pattern, '/**/') && (defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) { + if (0 !== strpos($this->prefix, 'phar://') && false === strpos($this->pattern, '/**/') && (defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) { foreach (glob($this->prefix.$this->pattern, defined('GLOB_BRACE') ? GLOB_BRACE : 0) as $path) { if ($this->recursive && is_dir($path)) { $files = iterator_to_array(new \RecursiveIteratorIterator(