From 4e13efaf968e009d82e76c8b58f6a03c52aabf30 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 15 Apr 2020 11:54:08 +0000 Subject: [PATCH] Code Modernization: Remove conditional use of `stream_get_contents()` PHP function. The function was introduced in PHP 5.0.0. Now that the minimum version of PHP required by WordPress is 5.6.20, these conditions are no longer needed. Props jrf. Fixes #48091. Built from https://develop.svn.wordpress.org/trunk@47584 git-svn-id: http://core.svn.wordpress.org/trunk@47359 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-filesystem-ssh2.php | 15 ++------------- wp-admin/includes/file.php | 4 ++-- wp-includes/version.php | 2 +- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php index 41642443d9..03e0f798b7 100644 --- a/wp-admin/includes/class-wp-filesystem-ssh2.php +++ b/wp-admin/includes/class-wp-filesystem-ssh2.php @@ -6,7 +6,7 @@ * * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes * - * Complie libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now, But many users have found the latest versions work) + * Compile libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now, But many users have found the latest versions work) * * cd /usr/src * wget https://www.libssh2.org/download/libssh2-0.14.tar.gz @@ -26,7 +26,7 @@ * Restart Apache! * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp exist. * - * Note: as of WordPress 2.8, This utilises the PHP5+ function 'stream_get_contents' + * Note: As of WordPress 2.8, this utilises the PHP5+ function `stream_get_contents()`. * * @since 2.7.0 * @@ -69,17 +69,6 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base { $this->errors->add( 'no_ssh2_ext', __( 'The ssh2 PHP extension is not available' ) ); return; } - if ( ! function_exists( 'stream_get_contents' ) ) { - $this->errors->add( - 'ssh2_php_requirement', - sprintf( - /* translators: %s: stream_get_contents() */ - __( 'The ssh2 PHP extension is available, however, we require the PHP5 function %s' ), - 'stream_get_contents()' - ) - ); - return; - } // Set defaults: if ( empty( $opt['port'] ) ) { diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 53967c6dfb..9933061321 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -1924,7 +1924,7 @@ function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f } } - if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) && function_exists( 'stream_get_contents' ) ) { + if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) ) { $method = 'ssh2'; } if ( ! $method && extension_loaded( 'ftp' ) ) { @@ -2108,7 +2108,7 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false, if ( extension_loaded( 'ftp' ) ) { // Only this supports FTPS. $types['ftps'] = __( 'FTPS (SSL)' ); } - if ( extension_loaded( 'ssh2' ) && function_exists( 'stream_get_contents' ) ) { + if ( extension_loaded( 'ssh2' ) ) { $types['ssh'] = __( 'SSH2' ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 01fc5a98bd..ea1d43f002 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47583'; +$wp_version = '5.5-alpha-47584'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.