WordPress.org

Make WordPress Core

Changeset 49068


Ignore:
Timestamp:
09/29/2020 10:01:05 AM (10 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r48757 r49068  
    10251025        // Only run the replacement if an sprintf() string format pattern was found.
    10261026        if ( preg_match( '#(?<!%)%(?:\d+\$?)?s#', $default ) ) {
     1027            // Remove a single trailing percent sign.
     1028            $default = preg_replace( '#(?<!%)%$#', '', $default );
    10271029            $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
    10281030        }
Note: See TracChangeset for help on using the changeset viewer.