10000 Merge branch '3.4' into 4.0 · symfony/symfony@641ecbb · GitHub
[go: up one dir, main page]

Skip to content

Commit 641ecbb

Browse files
Merge branch '3.4' into 4.0
* 3.4: [Cache] Improve resiliency when calling doFetch() in AbstractTrait Fixing GlobResource when inside phar archive
2 parents 6d26d9a + b61c8fc commit 641ecbb

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/Symfony/Component/Cache/Traits/AbstractTrait.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,11 @@ public function clear()
108108
try {
109109
if ($cleared = $this->versioningIsEnabled) {
110110
$namespaceVersion = 2;
111-
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
112-
$namespaceVersion = 1 + (int) $v;
111+
try {
112+
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
113+
$namespaceVersion = 1 + (int) $v;
114+
}
115+
} catch (\Exception $e) {
113116
}
114117
$namespaceVersion .= ':';
115118
$cleared = $this->doSave(array('@'.$this->namespace => $namespaceVersion), 0);
@@ -236,8 +239,11 @@ private function getId($key)
236239

237240
if ($this->versioningIsEnabled && '' === $this->namespaceVersion) {
238241
$this->namespaceVersion = '1:';
239-
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
240-
$this->namespaceVersion = $v;
242+
try {
243+
foreach ($this->doFetch(array('@'.$this->namespace)) as $v) {
244+
$this->namespaceVersion = $v;
245+
}
246+
} catch (\Exception $e) {
241247
}
242248
}
243249

src/Symfony/Component/Config/Resource/GlobResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getIterator()
9393
return;
9494
}
9595

96-
if (false === strpos($this->pattern, '/**/') && (defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) {
96+
if (0 !== strpos($this->prefix, 'phar://') && false === strpos($this->pattern, '/**/') && (defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) {
9797
foreach (glob($this->prefix.$this->pattern, defined('GLOB_BRACE') ? GLOB_BRACE : 0) as $path) {
9898
if ($this->recursive && is_dir($path)) {
9999
$files = iterator_to_array(new \RecursiveIteratorIterator(

0 commit comments

Comments
 (0)
0