Make WordPress Core


Ignore:
Timestamp:
07/09/2019 05:44:42 AM (7 years ago)
Author:
pento
Message:

Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.

Noteable changes:

  • The magic_quotes_runtime and magic_quotes_sybase settings were removed in PHP 5.4, so no longer need to be set.
  • Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
  • Quite a few functions would cause errors if safe_mode was set. This setting was removed in PHP 5.4.
  • Only a handful of header() calls needed corresponding headers_sent() checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php

    r45583 r45611  
    115115
    116116                // Set the Connection to use Passive FTP
    117                 @ftp_pasv( $this->link, true );
     117                ftp_pasv( $this->link, true );
    118118                if ( @ftp_get_option( $this->link, FTP_TIMEOUT_SEC ) < FS_TIMEOUT ) {
    119119                        @ftp_set_option( $this->link, FTP_TIMEOUT_SEC, FS_TIMEOUT );
     
    141141                }
    142142
    143                 if ( ! @ftp_fget( $this->link, $temp, $file, FTP_BINARY ) ) {
     143                if ( ! ftp_fget( $this->link, $temp, $file, FTP_BINARY ) ) {
    144144                        fclose( $temp );
    145145                        unlink( $tempfile );
     
    206206                fseek( $temp, 0 ); // Skip back to the start of the file being written to
    207207
    208                 $ret = @ftp_fput( $this->link, $file, $temp, FTP_BINARY );
     208                $ret = ftp_fput( $this->link, $file, $temp, FTP_BINARY );
    209209
    210210                fclose( $temp );
     
    224224         */
    225225        public function cwd() {
    226                 $cwd = @ftp_pwd( $this->link );
     226                $cwd = ftp_pwd( $this->link );
    227227                if ( $cwd ) {
    228228                        $cwd = trailingslashit( $cwd );
     
    276276                // chmod the file or directory
    277277                if ( ! function_exists( 'ftp_chmod' ) ) {
    278                         return (bool) @ftp_site( $this->link, sprintf( 'CHMOD %o %s', $mode, $file ) );
    279                 }
    280                 return (bool) @ftp_chmod( $this->link, $mode, $file );
     278                        return (bool) ftp_site( $this->link, sprintf( 'CHMOD %o %s', $mode, $file ) );
     279                }
     280                return (bool) ftp_chmod( $this->link, $mode, $file );
    281281        }
    282282
     
    376376                }
    377377                if ( 'f' == $type || $this->is_file( $file ) ) {
    378                         return @ftp_delete( $this->link, $file );
     378                        return ftp_delete( $this->link, $file );
    379379                }
    380380                if ( ! $recursive ) {
    381                         return @ftp_rmdir( $this->link, $file );
     381                        return ftp_rmdir( $this->link, $file );
    382382                }
    383383
     
    388388                        }
    389389                }
    390                 return @ftp_rmdir( $this->link, $file );
     390                return ftp_rmdir( $this->link, $file );
    391391        }
    392392
     
    400400         */
    401401        public function exists( $file ) {
    402                 $list = @ftp_nlist( $this->link, $file );
     402                $list = ftp_nlist( $this->link, $file );
    403403
    404404                if ( empty( $list ) && $this->is_dir( $file ) ) {
     
    537537                }
    538538
    539                 if ( ! @ftp_mkdir( $this->link, $path ) ) {
     539                if ( ! ftp_mkdir( $this->link, $path ) ) {
    540540                        return false;
    541541                }
     
    588588                        $b['hour']   = $lucifer[4];
    589589                        $b['minute'] = $lucifer[5];
    590                         $b['time']   = @mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) == 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] );
     590                        $b['time']   = mktime( $lucifer[4] + ( strcasecmp( $lucifer[6], 'PM' ) == 0 ? 12 : 0 ), $lucifer[5], 0, $lucifer[1], $lucifer[2], $lucifer[3] );
    591591                        $b['am/pm']  = $lucifer[6];
    592592                        $b['name']   = $lucifer[8];
     
    618618                                        sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] );
    619619                                        sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] );
    620                                         $b['time'] = @mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] );
     620                                        $b['time'] = mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] );
    621621                                        $b['name'] = $lucifer[7];
    622622                                } else {
     
    679679                }
    680680
    681                 $pwd = @ftp_pwd( $this->link );
     681                $pwd = ftp_pwd( $this->link );
    682682                if ( ! @ftp_chdir( $this->link, $path ) ) { // Can't change to folder = folder doesn't exist.
    683683                        return false;
    684684                }
    685                 $list = @ftp_rawlist( $this->link, '-a', false );
     685                $list = ftp_rawlist( $this->link, '-a', false );
    686686                @ftp_chdir( $this->link, $pwd );
    687687
Note: See TracChangeset for help on using the changeset viewer.