mirror of
git://develop.git.wordpress.org/
synced 2025-02-13 03:04:42 +01:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@49068 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f070145fa9
commit
bf945a81ec
@ -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() );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user