Skip to content

Media: Fix wp_show_heic_upload_error() assigning to an undeclared variable. - #12830

Open
softglazee wants to merge 1 commit into
WordPress:trunkfrom
softglazee:fix/65802-heic-upload-error-variable
Open

Media: Fix wp_show_heic_upload_error() assigning to an undeclared variable.#12830
softglazee wants to merge 1 commit into
WordPress:trunkfrom
softglazee:fix/65802-heic-upload-error-variable

Conversation

@softglazee

Copy link
Copy Markdown

The wp_show_heic_upload_error() function assigned the HEIC upload error flag to an undeclared $plupload_init variable instead of the $plupload_settings parameter. As a result, the flag never reached the returned array. This behavior was introduced in [58849] and shipped in WordPress 6.7.0.

This patch updates the variable name to $plupload_settings so the flag is properly appended, and adds unit tests covering both the supported and unsupported HEIC editor cases.

Testing Instructions

These tests were run on trunk 8c3c976c25 using PHP 8.3.32 and PHPUnit 9.6.35.

  1. Run the newly added tests:
    npm run test:php -- --filter test_wp_show_heic_upload_error
  2. Confirm the tests pass with the fix:
    OK (2 tests, 7 assertions)
  3. Revert the change in src/wp-includes/media.php to test the baseline failure:
    git stash push src/wp-includes/media.php
  4. Re-run the tests:
    npm run test:php -- --filter test_wp_show_heic_upload_error
  5. Confirm the expected failure occurs without the patch:
    1) Tests_Media::test_wp_show_heic_upload_error_adds_flag_when_not_supported
    Failed asserting that an array has the key 'heic_upload_error'.
  6. Restore the change:
    git stash pop

Trac ticket: https://core.trac.wordpress.org/ticket/65802

Use of AI Tools

Used for: Investigating the underlying code paths, structuring the PHPUnit test scaffolding, and generating shell commands for the environment. The initial finding, manual measurements, Trac ticket description, and commit message are my own work.

@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 softglaze.

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.

…iable.

The function assigned the error flag to an undeclared $plupload_init variable instead of the $plupload_settings parameter, preventing the flag from reaching the returned array.

This behavior was introduced in [58849] and shipped in WordPress 6.7.0.

Adds unit tests covering both the supported and unsupported cases.

See #65802.
@softglazee
softglazee force-pushed the fix/65802-heic-upload-error-variable branch from a53c8ee to 13a5841 Compare August 5, 2026 00:29
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