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-direct.php

    r45424 r45611  
    9696         */
    9797        public function cwd() {
    98                 return @getcwd();
     98                return getcwd();
    9999        }
    100100
    … …  
    127127                }
    128128                if ( ! $recursive ) {
    129                         return @chgrp( $file, $group );
     129                        return chgrp( $file, $group );
    130130                }
    131131                if ( ! $this->is_dir( $file ) ) {
    132                         return @chgrp( $file, $group );
     132                        return chgrp( $file, $group );
    133133                }
    134134                // Is a directory, and we want recursive
    … …  
    166166
    167167                if ( ! $recursive || ! $this->is_dir( $file ) ) {
    168                         return @chmod( $file, $mode );
     168                        return chmod( $file, $mode );
    169169                }
    170170                // Is a directory, and we want recursive
    … …  
    194194                }
    195195                if ( ! $recursive ) {
    196                         return @chown( $file, $owner );
     196                        return chown( $file, $owner );
    197197                }
    198198                if ( ! $this->is_dir( $file ) ) {
    199                         return @chown( $file, $owner );
     199                        return chown( $file, $owner );
    200200                }
    201201                // Is a directory, and we want recursive
    … …  
    477477                        $atime = time();
    478478                }
    479                 return @touch( $file, $time, $atime );
     479                return touch( $file, $time, $atime );
    480480        }
    481481
    … …  
    565565                }
    566566
    567                 if ( ! $this->is_dir( $path ) ) {
    568                         return false;
    569                 }
    570 
    571                 $dir = @dir( $path );
     567                if ( ! $this->is_dir( $path ) || ! $this->is_readable( $dir ) ) {
     568                        return false;
     569                }
     570
     571                $dir = dir( $path );
    572572                if ( ! $dir ) {
    573573                        return false;
Note: See TracChangeset for help on using the changeset viewer.