Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b2c2a4

Browse files
bug#52502 [Config] PrefixingFileExistenceResource::__toString() to avoid conflict withFileResource (weaverryan)
This PR was submitted for the 6.3 branch but it was merged into the 5.4 branch instead.Discussion----------[Config] Prefixing `FileExistenceResource::__toString()` to avoid conflict with `FileResource`| Q | A| ------------- | ---| Branch? | 6.3| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues | Fixes issue in AssetMapper 6.4| License | MITHi!This bug causes a pretty critical AssetMapper 6.4 bug. The problem is that both `FileResource` and `FileExistenceResource` return the same `__toString()` for the same file:* [FileResource::__toString()](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/Config/Resource/FileResource.php#L43-L46)* [FileExistenceResource::__toString()](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/Config/Resource/FileExistenceResource.php#L39-L41)[SelfCheckingResourceChecker](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php#L40-L45) uses a static cache where the `ResourceInterface::__toString()` is the key for that string. That creates the following bug situation:A) Something checks for `FileExistenceResource` for `foo/bar.php`. This returns true and `SelfCheckingResourceChecker` now has `true` for fresh in its static cacheB) Something else checks for `FileResource` for `foo/bar.php`: they are checking to see if the file has been *modified*. But in instead of calling the actual `FileResource::isFresh()` method, it uses the `true` value from the static cache.Cheers!Commits-------9e8db58 [Config] Prefixing FileExistenceResource::__toString() to avoid conflict with FileResource
2 parents0ff9ed4 +9e8db58 commit9b2c2a4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎src/Symfony/Component/Config/Resource/FileExistenceResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(string $resource)
3838

3939
publicfunction__toString():string
4040
{
41-
return$this->resource;
41+
return'existence.'.$this->resource;
4242
}
4343

4444
publicfunctiongetResource():string

‎src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function tearDown(): void
3636

3737
publicfunctiontestToString()
3838
{
39-
$this->assertSame($this->file, (string)$this->resource);
39+
$this->assertSame('existence.'.$this->file, (string)$this->resource);
4040
}
4141

4242
publicfunctiontestGetResource()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp