Skip to content

Commit 1b44425

Browse files
committed
Fixing a bug in sprintf would cause metabox to completely fail.
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} ```
1 parent e5a9035 commit 1b44425

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

‎src/wp-includes/general-template.php‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -531,18 +531,17 @@ function wp_get_tooltip_helper( $content, $args = array() ) {
531531
// Tooltips are only used to visually display labels.
532532
$label = wp_strip_all_tags( $content, true );
533533
$markup = sprintf(
534-
'<span class="%1$s">
535-
' . $button . '
536-
<span popover="hint" id="%2$s" class="wp-tooltip__bubble" role="tooltip">' .
537-
'<span id="%2$s-text" class="wp-tooltip__text">%5$s</span>' .
538-
'</span>' .
539-
'</span>',
540-
esc_attr( $classes ),
541-
esc_attr( $id ),
542-
esc_attr( $label ),
543-
esc_attr( $icon ),
544-
esc_html( $content ),
545-
);
534+
'<span class="%1$s"> %6$s <span popover="hint" id="%2$s" class="wp-tooltip__bubble" role="tooltip">' .
535+
'<span id="%2$s-text" class="wp-tooltip__text">%5$s</span>' .
536+
'</span>' .
537+
'</span>',
538+
esc_attr( $classes ),
539+
esc_attr( $id ),
540+
esc_attr( $label ),
541+
esc_attr( $icon ),
542+
esc_html( $content ),
543+
$button
544+
);
546545
} else {
547546
/*
548547
* A `span` with `role="dialog"` is used instead of a `dialog` element to keep the

0 commit comments

Comments
 (0)