Skip to content

Media: Assign the HEIC upload error flag to the Plupload settings - #12828

Open
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65802-heic-upload-error-undeclared-var
Open

Media: Assign the HEIC upload error flag to the Plupload settings#12828
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65802-heic-upload-error-undeclared-var

Conversation

@itzmekhokan

Copy link
Copy Markdown

wp_show_heic_upload_error() assigned the heic_upload_error flag to an undeclared $plupload_init variable instead of the $plupload_settings parameter it receives, so the callback returned the settings untouched and the flag was never added.

What the problem was:

  • The typo was introduced in [58849] (#53645, shipped in 6.7.0); before that changeset the function assigned to $plupload_settings correctly.
  • The plupload_default_settings path is unaffected in practice, because wp_plupload_default_settings() already sets the flag inline.
  • The plupload_init path is broken: media_upload_form() sets the WebP and AVIF flags inline but relies on this callback for HEIC, so no error was shown on media-new.php or in the media-upload.php iframe when the server could not edit HEIC images.

What the fix does:

  • Assigns to $plupload_settings, restoring the behaviour the function has documented since 5.5.0.
  • Adds a regression test for the callback.

Approach and why:

  • One-character-scope fix on the assignment target — nothing else in the function or its two callers needs to change.
  • The heic_upload_error flag is a non-blocking notice in handlers.js; unlike WebP and AVIF it does not remove the file from the queue, so restoring it warns the user without preventing the upload.
  • The redundant inline HEIC check in wp_plupload_default_settings() was deliberately left alone: it is harmless (the callback assigns the same true) 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.

`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.
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props khokansardar.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant