Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Config] Prefixing FileExistenceResource::__toString() to avoid conflict with FileResource #52502

Merged

Conversation

weaverryan
Copy link
Member

@weaverryan weaverryan commented Nov 8, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fixes issue in AssetMapper 6.4
License MIT

Hi!

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:

SelfCheckingResourceChecker 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 cache
B) 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!

@carsonbot carsonbot added this to the 6.3 milestone Nov 8, 2023
@OskarStark OskarStark changed the title [Config] Prefixing FileExistenceResource::__toString() to avoid conflict with FileResource [Config] Prefixing FileExistenceResource::__toString() to avoid conflict with FileResource Nov 8, 2023
@nicolas-grekas nicolas-grekas modified the milestones: 6.3, 5.4 Nov 9, 2023
@nicolas-grekas
Copy link
Member

Good catch, thanks @weaverryan.

@nicolas-grekas nicolas-grekas merged commit 9b2c2a4 into symfony:5.4 Nov 9, 2023
7 of 11 checks passed
@chalasr
Copy link
Member

chalasr commented Nov 9, 2023

🚀

@weaverryan weaverryan deleted the config-cache-clashing-resource-string branch November 9, 2023 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants