diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 288e2b0f97..30c5f791d5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,16 +8,6 @@ tests/phpunit/tests - tests/phpunit/tests/actions/closures.php - tests/phpunit/tests/image/editor.php - tests/phpunit/tests/image/editorGd.php - tests/phpunit/tests/image/editorImagick.php - tests/phpunit/tests/oembed/headers.php - tests/phpunit/tests/actions/closures.php - tests/phpunit/tests/image/editor.php - tests/phpunit/tests/image/editorGd.php - tests/phpunit/tests/image/editorImagick.php - tests/phpunit/tests/oembed/headers.php tests/phpunit/tests/rest-api/rest-autosaves-controller.php diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 2636489bea..e1ca84fb15 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/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/src/wp-includes/class-wp-locale.php b/src/wp-includes/class-wp-locale.php index 8582964a07..875a061568 100644 --- a/src/wp-includes/class-wp-locale.php +++ b/src/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/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index feed291794..63397aea5d 100644 --- a/src/wp-includes/formatting.php +++ b/src/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/src/wp-includes/functions.php b/src/wp-includes/functions.php index c5f98e5c38..d3dded8078 100644 --- a/src/wp-includes/functions.php +++ b/src/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/tests/phpunit/includes/utils.php b/tests/phpunit/includes/utils.php index a213bce0d0..9a03250f6a 100644 --- a/tests/phpunit/includes/utils.php +++ b/tests/phpunit/includes/utils.php @@ -465,12 +465,8 @@ class WpdbExposedMethodsForTesting extends wpdb { function benchmark_pcre_backtracking( $pattern, $subject, $strategy ) { $saved_config = ini_get( 'pcre.backtrack_limit' ); - // Attempt to prevent PHP crashes. Adjust these lower when needed. - if ( version_compare( phpversion(), '5.4.8', '>' ) ) { - $limit = 1000000; - } else { - $limit = 20000; // 20,000 is a reasonable upper limit, but see also https://core.trac.wordpress.org/ticket/29557#comment:10 - } + // Attempt to prevent PHP crashes. Adjust these lower when needed. + $limit = 1000000; // Start with small numbers, so if a crash is encountered at higher numbers we can still debug the problem. for ( $i = 4; $i <= $limit; $i *= 2 ) { diff --git a/tests/phpunit/multisite.xml b/tests/phpunit/multisite.xml index 620b20fc0d..73934a7a90 100644 --- a/tests/phpunit/multisite.xml +++ b/tests/phpunit/multisite.xml @@ -12,14 +12,6 @@ tests - tests/phpunit/tests/actions/closures.php - tests/phpunit/tests/image/editor.php - tests/phpunit/tests/image/editorGd.php - tests/phpunit/tests/image/editorImagick.php - tests/phpunit/tests/actions/closures.php - tests/phpunit/tests/image/editor.php - tests/phpunit/tests/image/editorGd.php - tests/phpunit/tests/image/editorImagick.php tests/phpunit/tests/rest-api/rest-autosaves-controller.php diff --git a/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php b/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php index 9c9be20f92..debe163862 100644 --- a/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php +++ b/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php @@ -24,10 +24,6 @@ class Tests_Admin_WpPrivacyRequestsTable extends WP_UnitTestCase { * @return PHPUnit_Framework_MockObject_MockObject|WP_Privacy_Requests_Table $instance Mocked class instance. */ public function get_mocked_class_instance() { - if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { - $this->markTestSkipped( 'ReflectionMethod::setAccessible is only available in PHP 5.3+' ); - } - $args = array( 'plural' => 'privacy_requests', 'singular' => 'privacy_request', diff --git a/tests/phpunit/tests/compat.php b/tests/phpunit/tests/compat.php index 92cefbf946..dd6e06c0af 100644 --- a/tests/phpunit/tests/compat.php +++ b/tests/phpunit/tests/compat.php @@ -249,11 +249,6 @@ EOT; $this->markTestSkipped( 'The intl extension is not loaded. ResourceBundle not tested for is_countable().' ); } - if ( version_compare( PHP_VERSION, '5.4', '<' ) ) { - $this->markTestSkipped( 'ResourceBundle is only countable in PHP 5.4+' ); - return; - } - $this->assertTrue( is_countable( new ResourceBundle( 'en', null ) ) ); } diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php index e7387773ac..1de6047097 100644 --- a/tests/phpunit/tests/customize/nav-menus.php +++ b/tests/phpunit/tests/customize/nav-menus.php @@ -1083,9 +1083,7 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase { ); // Add global namespace prefix to check #41488. - if ( version_compare( PHP_VERSION, '5.3', '>=' ) ) { - $original_args['fallback_cb'] = '\\' . $original_args['fallback_cb']; - } + $original_args['fallback_cb'] = '\\' . $original_args['fallback_cb']; $args = $menus->filter_wp_nav_menu_args( $original_args ); diff --git a/tests/phpunit/tests/db/charset.php b/tests/phpunit/tests/db/charset.php index 3089ec9a74..dc7f7c3b8f 100644 --- a/tests/phpunit/tests/db/charset.php +++ b/tests/phpunit/tests/db/charset.php @@ -482,10 +482,6 @@ class Tests_DB_Charset extends WP_UnitTestCase { * @ticket 21212 */ function test_strip_invalid_text( $data, $expected, $message ) { - if ( version_compare( PHP_VERSION, '5.3', '<' ) && stristr( php_uname( 's' ), 'win' ) ) { - $this->markTestSkipped( 'This test fails in PHP 5.2 on Windows. See https://core.trac.wordpress.org/ticket/31262' ); - } - $charset = self::$_wpdb->charset; if ( isset( $data[0]['connection_charset'] ) ) { $new_charset = $data[0]['connection_charset']; diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index 2191af7ddb..dd29c779e5 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -918,10 +918,6 @@ class Tests_Functions extends WP_UnitTestCase { * @ticket 28786 */ function test_wp_json_encode_depth() { - if ( version_compare( PHP_VERSION, '5.5', '<' ) ) { - $this->markTestSkipped( 'json_encode() supports the $depth parameter in PHP 5.5+' ); - }; - $data = array( array( array( 1, 2, 3 ) ) ); $json = wp_json_encode( $data, 0, 1 ); $this->assertFalse( $json ); diff --git a/tests/phpunit/tests/post/query.php b/tests/phpunit/tests/post/query.php index 7388dc24b7..4bac94c1bc 100644 --- a/tests/phpunit/tests/post/query.php +++ b/tests/phpunit/tests/post/query.php @@ -705,11 +705,6 @@ class Tests_Post_Query extends WP_UnitTestCase { * @dataProvider set_found_posts_provider */ public function test_set_found_posts_not_posts_as_an_array( $posts, $expected ) { - if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { - $this->markTestSkipped( 'ReflectionMethod::setAccessible is only available in PHP 5.3+' ); - return; - } - $q = new WP_Query( array( 'post_type' => 'wptests_pt', diff --git a/tests/phpunit/tests/rest-api/rest-request.php b/tests/phpunit/tests/rest-api/rest-request.php index cf3d79142c..2dd539a509 100644 --- a/tests/phpunit/tests/rest-api/rest-request.php +++ b/tests/phpunit/tests/rest-api/rest-request.php @@ -491,10 +491,6 @@ class Tests_REST_Request extends WP_UnitTestCase { } public function test_has_valid_params_json_error() { - if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { - return $this->markTestSkipped( 'JSON validation is only available for PHP 5.3+' ); - } - $this->request->set_header( 'Content-Type', 'application/json' ); $this->request->set_body( '{"invalid": JSON}' ); @@ -507,10 +503,6 @@ class Tests_REST_Request extends WP_UnitTestCase { public function test_has_valid_params_empty_json_no_error() { - if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { - return $this->markTestSkipped( 'JSON validation is only available for PHP 5.3+' ); - } - $this->request->set_header( 'Content-Type', 'application/json' ); $this->request->set_body( '' ); diff --git a/tests/phpunit/tests/theme/customHeader.php b/tests/phpunit/tests/theme/customHeader.php index eeb240fc91..65b037042a 100644 --- a/tests/phpunit/tests/theme/customHeader.php +++ b/tests/phpunit/tests/theme/customHeader.php @@ -126,10 +126,6 @@ class Tests_Theme_Custom_Header extends WP_UnitTestCase { $this->assertFalse( has_custom_header() ); $this->assertEmpty( $html ); - // ReflectionMethod::setAccessible is only available in PHP 5.3+ - if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { - return; - } // The container should always be returned in the Customizer preview. $this->_set_customize_previewing( true ); $html = get_custom_header_markup(); @@ -226,11 +222,6 @@ class Tests_Theme_Custom_Header extends WP_UnitTestCase { } function test_header_script_is_enqueued_by_the_custom_header_markup_without_video_when_previewing_in_customizer() { - if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { - $this->markTestSkipped( 'ReflectionMethod::setAccessible is only available in PHP 5.3+' ); - return; - } - $this->_add_theme_support( array( 'video' => true, diff --git a/tests/phpunit/tests/widgets/media-widget.php b/tests/phpunit/tests/widgets/media-widget.php index 86a06eccc6..6b9dc926ce 100644 --- a/tests/phpunit/tests/widgets/media-widget.php +++ b/tests/phpunit/tests/widgets/media-widget.php @@ -479,11 +479,6 @@ class Test_WP_Widget_Media extends WP_UnitTestCase { * @covers WP_Widget_Media::has_content() */ function test_has_content() { - if ( version_compare( PHP_VERSION, '5.3', '<' ) ) { - $this->markTestSkipped( 'ReflectionMethod::setAccessible is only available for PHP 5.3+' ); - return; - } - $attachment_id = self::factory()->attachment->create_object( array( 'file' => DIR_TESTDATA . '/images/canola.jpg',