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

Avoid PHP warning when getting dynamic template data #44783

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

Mamaduka
Copy link
Member

@Mamaduka Mamaduka commented Oct 7, 2022

What?

PR fixes the following warning generated by _gutenberg_build_title_and_description_for_single_post_type_block_template.

PHP Warning:  sprintf(): Argument number must be greater than zero

Why?

The sprintf argument number specifier must have a number - https://3v4l.org/EHGss

How?

Remove the number specifier; the string has only one placeholder.

Testing Instructions

  1. Open a Site Editor
  2. Confirm the warning isn't logged or displayed.

@Mamaduka Mamaduka requested a review from spacedmonkey as a code owner October 7, 2022 14:07
@Mamaduka Mamaduka self-assigned this Oct 7, 2022
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Templates API Related to API powering block template functionality in the Site Editor labels Oct 7, 2022
@Mamaduka
Copy link
Member Author

Mamaduka commented Oct 7, 2022

@ockham, do you remember if this was this fixed in PHP backport PR?

@ockham
Copy link
Contributor

ockham commented Oct 7, 2022

@ockham, do you remember if this was this fixed in PHP backport PR?

Looks like we did: https://github.com/WordPress/wordpress-develop/blob/494d20c469925a2da030a06dbdf8a7bad5f68938/src/wp-includes/block-template-utils.php#L578

@Mamaduka Mamaduka merged commit 24a886c into trunk Oct 7, 2022
@Mamaduka Mamaduka deleted the fix/block-template-utils-php-warning branch October 7, 2022 15:43
@github-actions github-actions bot added this to the Gutenberg 14.4 milestone Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants