Skip to content

Fixing a bug in sprintf would cause metabox to completely fail. - #13321

Open
jack9603301 wants to merge 4 commits into
WordPress:trunkfrom
jack9603301:trunk
Open

Fixing a bug in sprintf would cause metabox to completely fail.#13321
jack9603301 wants to merge 4 commits into
WordPress:trunkfrom
jack9603301:trunk

Conversation

@jack9603301

@jack9603301 jack9603301 commented Aug 30, 2026

Copy link
Copy Markdown

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

When $button has a structure like %a, a PHP parser error can cause Pods or other similar custom metadata blocks to fail to display, resulting in a serious problem. This often disrupts the normal management and use of WordPress. This patch corrects this issue in a way that has been verified to be effective!

It's worth noting that, whether we like it or not, this solution is generated by AI combined with internet data retrieval. This solution is very simple and therefore involves no human creativity; I must admit, it was generated by AI.

Hopefully, it can be merged quickly to resolve the issue as much as possible. It aims to fix the following bugs:

  thrown in /var/www/wordpress/wp-includes/general-template.php on line
533" while reading response header from upstream, client: 10.20.245.1,
server: www.qhjack.top, request: "GET
/wp-admin/post.php?post=582&action=edit HTTP/1.0", upstream:
"fastcgi://unix:///run/php/php8.5-fpm.sock:", host: "www.qhjack.top",
referrer: "https://www.qhjack.top/wp-admin/edit.php?post_type=services"
2026/08/30 16:25:15 [error] 289643#289643: *106436 FastCGI sent in
stderr: "PHP message: PHP Fatal error:  Uncaught ValueError: Unknown
format specifier "a" in
/var/www/wordpress/wp-includes/general-template.php:533
Stack trace:
#0 /var/www/wordpress/wp-includes/general-template.php(533): sprintf()
#1 /var/www/wordpress/wp-includes/general-template.php(400):
wp_get_tooltip_helper()
#2 /var/www/wordpress/wp-admin/includes/template.php(1410):
wp_get_tooltip()
#3 /var/www/wordpress/wp-admin/includes/post.php(2392): do_meta_boxes()
#4 /var/www/wordpress/wp-admin/edit-form-blocks.php(401):
the_block_editor_meta_boxes()
#5 /var/www/wordpress/wp-admin/post.php(199): require('...')
#6 {main}

Use of AI Tools

AI assistance: Yes
Tool(s): chrome/openwebui
Model(s): Gemini/Doubao AI
Used for: Apart from the former which uses AI entirely, it is mainly used for fault investigation and internet information retrieval.

trac: https://core.trac.wordpress.org/ticket/65914

When `$button` has a structure like `%a`, a PHP parser error can cause
Pods or other similar custom metadata blocks to fail to display,
resulting in a serious problem. This often disrupts the normal
management and use of WordPress. This patch corrects this issue in a way
that has been verified to be effective!

It's worth noting that, whether we like it or not, this solution is
generated by AI combined with internet data retrieval. This solution is
very simple and therefore involves no human creativity; I must admit, it
was generated by AI.

Hopefully, it can be merged quickly to resolve the issue as much as
possible. It aims to fix the following bugs:

```
  thrown in /var/www/wordpress/wp-includes/general-template.php on line
533" while reading response header from upstream, client: 10.20.245.1,
server: www.qhjack.top, request: "GET
/wp-admin/post.php?post=582&action=edit HTTP/1.0", upstream:
"fastcgi://unix:///run/php/php8.5-fpm.sock:", host: "www.qhjack.top",
referrer: "https://www.qhjack.top/wp-admin/edit.php?post_type=services"
2026/08/30 16:25:15 [error] 289643#289643: *106436 FastCGI sent in
stderr: "PHP message: PHP Fatal error:  Uncaught ValueError: Unknown
format specifier "a" in
/var/www/wordpress/wp-includes/general-template.php:533
Stack trace:
#0 /var/www/wordpress/wp-includes/general-template.php(533): sprintf()
WordPress#1 /var/www/wordpress/wp-includes/general-template.php(400):
wp_get_tooltip_helper()
WordPress#2 /var/www/wordpress/wp-admin/includes/template.php(1410):
wp_get_tooltip()
WordPress#3 /var/www/wordpress/wp-admin/includes/post.php(2392): do_meta_boxes()
WordPress#4 /var/www/wordpress/wp-admin/edit-form-blocks.php(401):
the_block_editor_meta_boxes()
WordPress#5 /var/www/wordpress/wp-admin/post.php(199): require('...')
WordPress#6 {main}
```
@github-actions

github-actions Bot commented Aug 30, 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 jack960330.

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

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

@jack9603301
jack9603301 force-pushed the trunk branch 2 times, most recently from cba3e1d to eab92b5 Compare August 30, 2026 17:17
Signed-off-by: Chunhui Ouyang <jack9603301@qhjack.top>
The previous solution did not handle placeholders like %a in $button, which caused test errors.
This update fixes the % placeholder parsing issue in $button, building upon the previous commit.

This submission uses AI only as a search engine to provide references and has proven that the previous AI-generated solutions were partially flawed.

Signed-off-by: Chunhui Ouyang <jack9603301@qhjack.top>
The third commit, at least on my end, worked and employs a specific
method to prevent %a from being incorrectly parsed by sprintf in
URL-encoded non-English strings.

If we assume the fix in the third commit works, then the current changes
should also work, since the overall layout of sprintf is the same.

This commit was not AI-driven.

Signed-off-by: Chunhui Ouyang <jack9603301@qhjack.top>
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