- First commit to issue fork.
- Merge request !7596Issue #3207669: file_get_file_references() can cause PHP out of memory errors → (Open) created by apaderno
- last update
10 months ago 2,179 pass
If you have a managed file that is referenced by 200k entities then file_get_file_references() will cause PHP out of memory errors. It uses an unlimited entity field query and unlimited queries are bad.
Create a managed file and reference it from 200k nodes.
Then invoke hook_file_download() for example from entity_metadata_file_access().
You get a PHP memory error.
Limit the query to just 1 result. This is not ideal and could cause problems, but in our use case a file is always used in the same field type. That has no access implications for us.
Review patch, come up with a better idea?
Needs review
7.0 ⚰️
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.