Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Date Block: Fix PHP warning error #62783

Merged
merged 1 commit into from
Jun 25, 2024
Merged

Conversation

t-hamano
Copy link
Contributor

Fixes #62763
Follow-up #62298

What?

This PR fixes a PHP warning error that occurs when "Display last modified date" in the Post Date block is enabled.

Warning: Undefined array key "format" in /var/www/html/wp-content/plugins/gutenberg/build/block-library/blocks/post-date.php on line 47

Why?

In #62298, the relative time format was added. However, it seems that a check for undefined was missing in one place.

Testing Instructions

  • Insert a Post Date block into a post and enable "Display last modified date". Do not disable "Default format". Alternatively, use the HTML below:

    <!-- wp:post-date {"displayType":"modified"} /-->
  • No errors should occur on the front end.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended Backport to WP 6.6 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta [Block] Post Date Affects the Post Date Block labels Jun 24, 2024
@t-hamano t-hamano self-assigned this Jun 24, 2024
@t-hamano t-hamano marked this pull request as ready for review June 24, 2024 11:08
@t-hamano t-hamano requested a review from ajitbohra as a code owner June 24, 2024 11:08
Copy link

github-actions bot commented Jun 24, 2024

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @ametaplus.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: ametaplus.

Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>

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

@t-hamano
Copy link
Contributor Author

This issue was introduced in WP6.6, so I'm giving it the backport label.

@ellatrix ellatrix force-pushed the post-date/fix-warning-error branch from 95e1d99 to 47e3c70 Compare June 25, 2024 05:04
@ellatrix ellatrix enabled auto-merge (squash) June 25, 2024 05:04
@ellatrix ellatrix merged commit 525f792 into trunk Jun 25, 2024
60 checks passed
@ellatrix ellatrix deleted the post-date/fix-warning-error branch June 25, 2024 06:33
@github-actions github-actions bot added this to the Gutenberg 18.7 milestone Jun 25, 2024
@ellatrix ellatrix removed the Backport to WP 6.6 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Jun 25, 2024
@ellatrix
Copy link
Member

@t-hamano This shouldn't be backported because the original PR wasn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Date Affects the Post Date Block [Type] Bug An existing feature does not function as intended
2 participants