Fixing a bug in sprintf would cause metabox to completely fail. - #13321
Fixing a bug in sprintf would cause metabox to completely fail.#13321jack9603301 wants to merge 4 commits into
Conversation
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} ```
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
cba3e1d to
eab92b5
Compare
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>
Trac ticket: https://core.trac.wordpress.org/ticket/65914
When
$buttonhas 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:
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.