Skip to content

Fix solution for empty.offset error in wp_read_video_metadata() - #15303

Closed
westonruter wants to merge 2 commits into
WordPress:trunkfrom
westonruter:phpstan/retire-empty-offset-follow-up
Closed

westonruter wants to merge 2 commits into
WordPress:trunkfrom
westonruter:phpstan/retire-empty-offset-follow-up

Conversation

@westonruter

Copy link
Copy Markdown
Member

This is a follow-up to feedback on #14027:

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

Use of AI Tools

AI assistance: None 🧠


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.

@github-actions

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.

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

Props westonruter.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the video-metadata simplification and pointer-documentation cleanup.

No open issues 🎉

What changed in this PR

This follow-up to #14027 simplifies the empty.offset fix in video metadata handling and consolidates internal-pointer type documentation.

Changes:

  • Removes the redundant timestamp guard and broad $metadata type annotation from wp_read_video_metadata().
  • Moves pointer array type annotations into existing comments, converting them to docblocks without changing runtime behavior.
File Description
src/​wp-admin/​includes/​media.php Simplifies creation-timestamp assignment and removes the metadata type annotation.
src/​wp-admin/​includes/​class-wp-internal-pointers.php Consolidates array type annotations into descriptive docblocks.

Review effort: Balanced

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with this correction. created_timestamp cannot be populated before the removed condition, so removing that condition preserves behavior and lets PHPStan infer the metadata shape. The strict false check remains, and both pointer annotations retain their original types.

Full PHPStan passed. The existing media-metadata checks passed before and after the patch in randomized single-site and multisite runs: nine tests and nine assertions per run. Syntax checks passed; full-file PHPCS reports only the same three pre-existing warnings. Copilot found no active issue. No additional tests are needed for this behavior-equivalent simplification.

Approved on code and local validation; CI is still running before landing.

AI review · gpt-6

@lancewillett lancewillett self-assigned this Oct 31, 2026
wporg-sync pushed a commit that referenced this pull request Oct 31, 2026
Remove the broad `$metadata` annotation and the always-true `created_timestamp` guard in `wp_read_video_metadata()`. Preserve the timestamp helper call and strict `false` check.

Combine the pointer array type annotations with their explanatory docblocks.

Follow-up to [65149].

Developed in: #15303

Props westonruter.
See #65817.


git-svn-id: https://develop.svn.wordpress.org/trunk@65158 602fd350-edb4-49c9-b593-d223f7449a82
@lancewillett

Copy link
Copy Markdown
Member

wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 31, 2026
Remove the broad `$metadata` annotation and the always-true `created_timestamp` guard in `wp_read_video_metadata()`. Preserve the timestamp helper call and strict `false` check.

Combine the pointer array type annotations with their explanatory docblocks.

Follow-up to [65149].

Developed in: WordPress/wordpress-develop#15303

Props westonruter.
See #65817.

Built from https://develop.svn.wordpress.org/trunk@65158


git-svn-id: http://core.svn.wordpress.org/trunk@64307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.

3 participants