Media: Assign the HEIC upload error flag to the Plupload settings - #12828
Media: Assign the HEIC upload error flag to the Plupload settings#12828itzmekhokan wants to merge 1 commit into
Conversation
`wp_show_heic_upload_error()` assigned `heic_upload_error` to an undeclared `$plupload_init` variable instead of the `$plupload_settings` parameter it receives, so the callback returned the settings unchanged and the flag was never added. The `plupload_default_settings` path was unaffected in practice, as `wp_plupload_default_settings()` already sets the flag inline. The `plupload_init` path, used by `media_upload_form()` on media-new.php and in the media-upload.php iframe, sets the WebP and AVIF flags inline but relies on this callback for HEIC, so no error was shown there when the server could not edit HEIC images. Assign to the parameter, and add a regression test. Follow-up to [58849]. Fixes #65802.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
wp_show_heic_upload_error()assigned theheic_upload_errorflag to an undeclared$plupload_initvariable instead of the$plupload_settingsparameter it receives, so the callback returned the settings untouched and the flag was never added.What the problem was:
$plupload_settingscorrectly.plupload_default_settingspath is unaffected in practice, becausewp_plupload_default_settings()already sets the flag inline.plupload_initpath is broken:media_upload_form()sets the WebP and AVIF flags inline but relies on this callback for HEIC, so no error was shown onmedia-new.phpor in themedia-upload.phpiframe when the server could not edit HEIC images.What the fix does:
$plupload_settings, restoring the behaviour the function has documented since 5.5.0.Approach and why:
heic_upload_errorflag is a non-blocking notice inhandlers.js; unlike WebP and AVIF it does not remove the file from the queue, so restoring it warns the user without preventing the upload.wp_plupload_default_settings()was deliberately left alone: it is harmless (the callback assigns the sametrue) and removing it would change behaviour for anyone who has unhooked the callback.Trac ticket: https://core.trac.wordpress.org/ticket/65802
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Generate PR.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.