WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/09/2019 05:44:42 AM (8 months 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/file.php

    r45583 r45611  
    166166            }
    167167        }
    168     }
    169     @closedir( $dir );
     168
     169        closedir( $dir );
     170    }
    170171
    171172    return $files;
     
    515516
    516517        // Make sure PHP process doesn't die before loopback requests complete.
    517         @set_time_limit( 300 );
     518        set_time_limit( 300 );
    518519
    519520        // Time to wait for loopback requests to finish.
     
    781782
    782783    // A properly uploaded file will pass this test. There should be no reason to override this one.
    783     $test_uploaded_file = 'wp_handle_upload' === $action ? @ is_uploaded_file( $file['tmp_name'] ) : @ is_readable( $file['tmp_name'] );
     784    $test_uploaded_file = 'wp_handle_upload' === $action ? is_uploaded_file( $file['tmp_name'] ) : @is_readable( $file['tmp_name'] );
    784785    if ( ! $test_uploaded_file ) {
    785786        return call_user_func_array( $upload_error_handler, array( &$file, __( 'Specified file failed upload test.' ) ) );
     
    849850    if ( null === $move_new_file ) {
    850851        if ( 'wp_handle_upload' === $action ) {
    851             $move_new_file = @ move_uploaded_file( $file['tmp_name'], $new_file );
     852            $move_new_file = @move_uploaded_file( $file['tmp_name'], $new_file );
    852853        } else {
    853854            // use copy and unlink because rename breaks streams.
    854             $move_new_file = @ copy( $file['tmp_name'], $new_file );
     855            // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
     856            $move_new_file = @copy( $file['tmp_name'], $new_file );
    855857            unlink( $file['tmp_name'] );
    856858        }
     
    869871    $stat  = stat( dirname( $new_file ) );
    870872    $perms = $stat['mode'] & 0000666;
    871     @ chmod( $new_file, $perms );
     873    chmod( $new_file, $perms );
    872874
    873875    // Compute the URL.
     
    18551857            }
    18561858
    1857             @fclose( $temp_handle );
     1859            fclose( $temp_handle );
    18581860            @unlink( $temp_file_name );
    18591861        }
Note: See TracChangeset for help on using the changeset viewer.