Problem/Motivation
file_save_upload() uses a static $upload_cache to avoid reprocessing a file already moved from its temporary path when the form rebuilds within the same request. This is a function-local static keyed by field name, with no service boundary, and blocks an service replacement in #3619418: Add a service to replace file_save_upload() and deprecate it that needs the same protection. This issue is a step toward deprecating file_save_upload().
Steps to reproduce
Proposed resolution
Use the CacheBackendInterface memory.cache bin service for file uploads. file_save_upload() calls it via \Drupal::service(), keyed by field name, storing the results for a field after first processing. The proposed new multi-file upload service in #3619418: Add a service to replace file_save_upload() and deprecate it will inject the same service normally.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-3619416
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3619416-add-a-request-scoped
changes, plain diff MR !16870
Comments
Comment #3
kim.pepperComment #4
kim.pepperComment #5
kim.pepperComment #6
kim.pepperComment #7
kim.pepperComment #8
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #9
kim.pepperThis was fixed in #3375423: Deprecate file_managed_file_save_upload(), file_save_upload() and _file_save_upload_from_form() and replace with a service