Make WordPress Core

Ticket #48689: 48689.diff

File 48689.diff, 1.5 KB (added by adamsilverstein, 4 years ago)
  • src/wp-admin/includes/class-wp-filesystem-ftpext.php

    diff --git src/wp-admin/includes/class-wp-filesystem-ftpext.php src/wp-admin/includes/class-wp-filesystem-ftpext.php
    index 038d8468ce..da748e94a1 100644
    class WP_Filesystem_FTPext extends WP_Filesystem_Base { 
    227227         * @return string|false The current working directory on success, false on failure.
    228228         */
    229229        public function cwd() {
     230                if ( is_null( $this->link ) ) {
     231                        return false;
     232                }
    230233                $cwd = ftp_pwd( $this->link );
    231234
    232235                if ( $cwd ) {
    class WP_Filesystem_FTPext extends WP_Filesystem_Base { 
    417420         * @return bool Whether $file exists or not.
    418421         */
    419422        public function exists( $file ) {
     423                if ( is_null( $this->link ) ) {
     424                        return false;
     425                }
    420426                $list = ftp_nlist( $this->link, $file );
    421427
    422428                if ( empty( $list ) && $this->is_dir( $file ) ) {
    class WP_Filesystem_FTPext extends WP_Filesystem_Base { 
    447453         * @return bool Whether $path is a directory.
    448454         */
    449455        public function is_dir( $path ) {
     456                if ( is_null( $this->link ) ) {
     457                        return false;
     458                }
    450459                $cwd    = $this->cwd();
    451460                $result = @ftp_chdir( $this->link, trailingslashit( $path ) );
    452461
    class WP_Filesystem_FTPext extends WP_Filesystem_Base { 
    714723                        $limit_file = false;
    715724                }
    716725
     726                if ( is_null( $this->link ) ){
     727                        return false;
     728                }
     729
    717730                $pwd = ftp_pwd( $this->link );
    718731
    719732                if ( ! @ftp_chdir( $this->link, $path ) ) { // Can't change to folder = folder doesn't exist.