Make WordPress Core

Ticket #51170: 51170.2.diff

File 51170.2.diff, 896 bytes (added by SergeyBiryukov, 4 years ago)
  • src/wp-admin/includes/class-wp-filesystem-ftpext.php

     
    510510         * Gets the file size (in bytes).
    511511         *
    512512         * @since 2.5.0
    513          * @since 6.1.0 Corrected the return value: while WP_Filesystem_Base::size()
    514          *              is documented to return false on failure, ftp_size() returns -1.
    515513         *
    516514         * @param string $file Path to file.
    517          * @return int Size of the file in bytes on success, -1 on failure.
     515         * @return int|false Size of the file in bytes on success, false on failure.
    518516         */
    519517        public function size( $file ) {
    520                 return ftp_size( $this->link, $file );
     518                $size = ftp_size( $this->link, $file );
     519
     520                return ( $size > -1 ) ? $size : false;
    521521        }
    522522
    523523        /**