Skip to content

Commit a34381a

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: (64 commits) Show exception is checked twice in ExceptionController of twig allow SSI fragments configuration in XML files Display a better error message when the toolbar cannot be displayed render hidden _method field in form_rest() Add Doctrine Cache to dev dependencies to fix failing unit tests. return fallback locales whenever possible Fix Predis client cluster with pipeline [Dotenv] Test load() with multiple paths [Console] Fix catching exception type in QuestionHelper Improved the exception page when there is no message [WebProfilerBundle] Eliminate line wrap on count columnt (routing) [Validator] replace hardcoded service id [Routing] Fix XmlFileLoader exception message [DI] Dedup tags when using instanceof/autoconfigure [Translation] Fix FileLoader::loadResource() php doc Sessions: configurable "use_strict_mode" option for NativeSessionStorage [FrameworkBundle] [Command] Clean bundle directory, fixes #23177 fixed CS [WebProfilerBundle] Fix the icon for the Cache panel [WebServerBundle] Fix router script path and check existence ...
2 parents d9696fc + a094618 commit a34381a

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

Resource/ComposerResource.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@
1818
*/
1919
class ComposerResource implements SelfCheckingResourceInterface, \Serializable
2020
{
21-
private $versions;
2221
private $vendors;
2322

24-
private static $runtimeVersion;
2523
private static $runtimeVendors;
2624

2725
public function __construct()
2826
{
2927
self::refresh();
30-
$this->versions = self::$runtimeVersion;
3128
$this->vendors = self::$runtimeVendors;
3229
}
3330

@@ -51,36 +48,23 @@ public function isFresh($timestamp)
5148
{
5249
self::refresh();
5350

54-
if (self::$runtimeVersion !== $this->versions) {
55-
return false;
56-
}
57-
5851
return self::$runtimeVendors === $this->vendors;
5952
}
6053

6154
public function serialize()
6255
{
63-
return serialize(array($this->versions, $this->vendors));
56+
return serialize($this->vendors);
6457
}
6558

6659
public function unserialize($serialized)
6760
{
68-
list($this->versions, $this->vendors) = unserialize($serialized);
61+
$this->vendors = unserialize($serialized);
6962
}
7063

7164
private static function refresh()
7265
{
73-
if (null !== self::$runtimeVersion) {
74-
return;
75-
}
76-
77-
self::$runtimeVersion = array();
7866
self::$runtimeVendors = array();
7967

80-
foreach (get_loaded_extensions() as $ext) {
81-
self::$runtimeVersion[$ext] = phpversion($ext);
82-
}
83-
8468
foreach (get_declared_classes() as $class) {
8569
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
8670
$r = new \ReflectionClass($class);

Resource/GlobResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function (\SplFileInfo $file) { return '.' !== $file->getBasename()[0]; }
134134

135135
$prefixLen = strlen($this->prefix);
136136
foreach ($finder->followLinks()->sortByName()->in($this->prefix) as $path => $info) {
137-
if (preg_match($regex, substr($path, $prefixLen)) && $info->isFile()) {
137+
if (preg_match($regex, substr('\\' === \DIRECTORY_SEPARATOR ? str_replace('\\', '/', $path) : $path, $prefixLen)) && $info->isFile()) {
138138
yield $path => $info;
139139
}
140140
}

Tests/Resource/GlobResourceTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ public function testIterator()
3636
$this->assertEquals(array($file => new \SplFileInfo($file)), $paths);
3737
$this->assertInstanceOf('SplFileInfo', current($paths));
3838
$this->assertSame($dir, $resource->getPrefix());
39+
40+
$resource = new GlobResource($dir, '/**/Resource', true);
41+
42+
$paths = iterator_to_array($resource);
43+
44+
$file = $dir.DIRECTORY_SEPARATOR.'Resource'.DIRECTORY_SEPARATOR.'ConditionalClass.php';
45+
$this->assertEquals(array($file => $file), $paths);
46+
$this->assertInstanceOf('SplFileInfo', current($paths));
47+
$this->assertSame($dir, $resource->getPrefix());
3948
}
4049

4150
public function testIsFreshNonRecursiveDetectsNewFile()

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
"symfony/filesystem": "~2.8|~3.0|~4.0"
2121
},
2222
"require-dev": {
23+
"symfony/finder": "~3.3|~4.0",
2324
"symfony/yaml": "~3.0|~4.0",
2425
"symfony/dependency-injection": "~3.3|~4.0"
2526
},
2627
"conflict": {
28+
"symfony/finder": "<3.3",
2729
"symfony/dependency-injection": "<3.3"
2830
},
2931
"suggest": {

0 commit comments

Comments
 (0)