Merge branch '4.1'

* 4.1:
  [Cache] Improve resiliency when calling doFetch() in AbstractTrait
  [Messenger] Fixed MessengerPass::guessHandledClasses return type
  Fixing GlobResource when inside phar archive
This commit is contained in:
Nicolas Grekas 2018-06-20 13:16:05 +02:00
commit 1abfb2ced6
2 changed files with 11 additions and 5 deletions

View File

@ -109,8 +109,11 @@ trait AbstractTrait
try {
if ($cleared = $this->versioningIsEnabled) {
$namespaceVersion = 2;
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
$namespaceVersion = 1 + (int) $v;
try {
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
$namespaceVersion = 1 + (int) $v;
}
} catch (\Exception $e) {
}
$namespaceVersion .= ':';
$cleared = $this->doSave(array('@'.$this->namespace => $namespaceVersion), 0);
@ -236,8 +239,11 @@ trait AbstractTrait
{
if ($this->versioningIsEnabled && '' === $this->namespaceVersion) {
$this->namespaceVersion = '1:';
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
$this->namespaceVersion = $v;
try {
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
$this->namespaceVersion = $v;
}
} catch (\Exception $e) {
}
}

View File

@ -93,7 +93,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface,
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(