From eb3f4208485fe8958c64e7d5b6ab510abc979bdb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 20 Sep 2019 22:02:57 +0000 Subject: [PATCH] Code Modernization: Remove all code using a `version_compare()` with a PHP version older than PHP 5.6. Props jrf. Fixes #48074. Built from https://develop.svn.wordpress.org/trunk@46214 git-svn-id: http://core.svn.wordpress.org/trunk@46026 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 7 ------- wp-includes/class-wp-locale.php | 9 ++------- wp-includes/formatting.php | 16 +++------------- wp-includes/functions.php | 7 +------ wp-includes/version.php | 2 +- 5 files changed, 7 insertions(+), 34 deletions(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 2636489bea..e1ca84fb15 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -1376,13 +1376,6 @@ final class WP_Customize_Manager { ) ); - // In PHP < 5.6 filesize() returns 0 for the temp files unless we clear the file status cache. - // Technically, PHP < 5.6.0 || < 5.5.13 || < 5.4.29 but no need to be so targeted. - // See https://bugs.php.net/bug.php?id=65701 - if ( version_compare( PHP_VERSION, '5.6', '<' ) ) { - clearstatcache(); - } - $attachment_id = media_handle_sideload( $file_array, 0, null, $attachment_post_data ); if ( is_wp_error( $attachment_id ) ) { continue; diff --git a/wp-includes/class-wp-locale.php b/wp-includes/class-wp-locale.php index 8582964a07..875a061568 100644 --- a/wp-includes/class-wp-locale.php +++ b/wp-includes/class-wp-locale.php @@ -199,13 +199,8 @@ class WP_Locale { /* translators: $thousands_sep argument for https://secure.php.net/number_format, default is ',' */ $thousands_sep = __( 'number_format_thousands_sep' ); - if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) { - // Replace space with a non-breaking space to avoid wrapping. - $thousands_sep = str_replace( ' ', ' ', $thousands_sep ); - } else { - // PHP < 5.4.0 does not support multiple bytes in thousands separator. - $thousands_sep = str_replace( array( ' ', ' ' ), ' ', $thousands_sep ); - } + // Replace space with a non-breaking space to avoid wrapping. + $thousands_sep = str_replace( ' ', ' ', $thousands_sep ); $this->number_format['thousands_sep'] = ( 'number_format_thousands_sep' === $thousands_sep ) ? ',' : $thousands_sep; diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 5d0ab841d3..c1d1d581cb 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -5572,15 +5572,10 @@ function _print_emoji_detection_script() { * @return string The encoded content. */ function wp_encode_emoji( $content ) { - $emoji = _wp_emoji_list( 'partials' ); - $compat = version_compare( phpversion(), '5.4', '<' ); + $emoji = _wp_emoji_list( 'partials' ); foreach ( $emoji as $emojum ) { - if ( $compat ) { - $emoji_char = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' ); - } else { - $emoji_char = html_entity_decode( $emojum ); - } + $emoji_char = html_entity_decode( $emojum ); if ( false !== strpos( $content, $emoji_char ) ) { $content = preg_replace( "/$emoji_char/", $emojum, $content ); } @@ -5616,14 +5611,9 @@ function wp_staticize_emoji( $text ) { // Quickly narrow down the list of emoji that might be in the text and need replacing. $possible_emoji = array(); - $compat = version_compare( phpversion(), '5.4', '<' ); foreach ( $emoji as $emojum ) { if ( false !== strpos( $text, $emojum ) ) { - if ( $compat ) { - $possible_emoji[ $emojum ] = html_entity_decode( $emojum, ENT_COMPAT, 'UTF-8' ); - } else { - $possible_emoji[ $emojum ] = html_entity_decode( $emojum ); - } + $possible_emoji[ $emojum ] = html_entity_decode( $emojum ); } } diff --git a/wp-includes/functions.php b/wp-includes/functions.php index c5f98e5c38..d3dded8078 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -6004,12 +6004,7 @@ function wp_allowed_protocols() { function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { static $truncate_paths; - if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) ) { - $trace = debug_backtrace( false ); - } else { - $trace = debug_backtrace(); - } - + $trace = debug_backtrace( false ); $caller = array(); $check_class = ! is_null( $ignore_class ); $skip_frames++; // skip this function diff --git a/wp-includes/version.php b/wp-includes/version.php index e23dbd4672..492dfd3d32 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-46213'; +$wp_version = '5.3-alpha-46214'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.