Make WordPress Core

Ticket #48091: 48091-src-Remove-work-arounds-for-stream_get_contents.patch

File 48091-src-Remove-work-arounds-for-stream_get_contents.patch, 2.3 KB (added by jrf, 5 years ago)

[src] Remove work-arounds for stream_get_contents()

  • src/wp-admin/includes/class-wp-filesystem-ssh2.php

    From d8ef681e4db1b1e15fe3401ee5f1a82625da0df9 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Sat, 27 Jul 2019 04:30:38 +0200
    Subject: [PATCH] [src] Remove work-arounds for stream_get_contents()
    
    ---
     src/wp-admin/includes/class-wp-filesystem-ssh2.php | 11 -----------
     src/wp-admin/includes/file.php                     |  4 ++--
     2 files changed, 2 insertions(+), 13 deletions(-)
    
    diff --git a/src/wp-admin/includes/class-wp-filesystem-ssh2.php b/src/wp-admin/includes/class-wp-filesystem-ssh2.php
    index cea45f1273..ccbabb0811 100644
    a b class WP_Filesystem_SSH2 extends WP_Filesystem_Base { 
    6969                        $this->errors->add( 'no_ssh2_ext', __( 'The ssh2 PHP extension is not available' ) );
    7070                        return;
    7171                }
    72                 if ( ! function_exists( 'stream_get_contents' ) ) {
    73                         $this->errors->add(
    74                                 'ssh2_php_requirement',
    75                                 sprintf(
    76                                         /* translators: %s: stream_get_contents() */
    77                                         __( 'The ssh2 PHP extension is available, however, we require the PHP5 function %s' ),
    78                                         '<code>stream_get_contents()</code>'
    79                                 )
    80                         );
    81                         return;
    82                 }
    8372
    8473                // Set defaults:
    8574                if ( empty( $opt['port'] ) ) {
  • src/wp-admin/includes/file.php

    diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
    index 9d5244202e..8315e73f1b 100644
    a b function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f 
    19441944                }
    19451945        }
    19461946
    1947         if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) && function_exists( 'stream_get_contents' ) ) {
     1947        if ( ! $method && isset( $args['connection_type'] ) && 'ssh' == $args['connection_type'] && extension_loaded( 'ssh2' ) ) {
    19481948                $method = 'ssh2';
    19491949        }
    19501950        if ( ! $method && extension_loaded( 'ftp' ) ) {
    function request_filesystem_credentials( $form_post, $type = '', $error = false, 
    21252125        if ( extension_loaded( 'ftp' ) ) { //Only this supports FTPS
    21262126                $types['ftps'] = __( 'FTPS (SSL)' );
    21272127        }
    2128         if ( extension_loaded( 'ssh2' ) && function_exists( 'stream_get_contents' ) ) {
     2128        if ( extension_loaded( 'ssh2' ) ) {
    21292129                $types['ssh'] = __( 'SSH2' );
    21302130        }
    21312131