Code Modernization: Remove a single trailing percent sign before calling `sprintf()` on the `$default` parameter in `get_theme_mod()`.

This avoids a "Missing format specifier at end of string" fatal error on PHP 8, and maintains the current behaviour.

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49068


git-svn-id: http://core.svn.wordpress.org/trunk@48830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-09-29 10:03:08 +00:00
parent 41681b29b0
commit 12a36355e6
2 changed files with 3 additions and 1 deletions

View File

@ -1024,6 +1024,8 @@ function get_theme_mod( $name, $default = false ) {
if ( is_string( $default ) ) {
// Only run the replacement if an sprintf() string format pattern was found.
if ( preg_match( '#(?<!%)%(?:\d+\$?)?s#', $default ) ) {
// Remove a single trailing percent sign.
$default = preg_replace( '#(?<!%)%$#', '', $default );
$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
}
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-49067';
$wp_version = '5.6-alpha-49068';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.