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. Built from https://develop.svn.wordpress.org/trunk@45611 git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -165,8 +165,9 @@ function list_files( $folder = '', $levels = 100, $exclusions = array() ) {
|
||||
$files[] = $folder . $file;
|
||||
}
|
||||
}
|
||||
|
||||
closedir( $dir );
|
||||
}
|
||||
@closedir( $dir );
|
||||
|
||||
return $files;
|
||||
}
|
||||
@@ -514,7 +515,7 @@ function wp_edit_theme_plugin_file( $args ) {
|
||||
}
|
||||
|
||||
// Make sure PHP process doesn't die before loopback requests complete.
|
||||
@set_time_limit( 300 );
|
||||
set_time_limit( 300 );
|
||||
|
||||
// Time to wait for loopback requests to finish.
|
||||
$timeout = 100;
|
||||
@@ -780,7 +781,7 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
|
||||
}
|
||||
|
||||
// A properly uploaded file will pass this test. There should be no reason to override this one.
|
||||
$test_uploaded_file = 'wp_handle_upload' === $action ? @ is_uploaded_file( $file['tmp_name'] ) : @ is_readable( $file['tmp_name'] );
|
||||
$test_uploaded_file = 'wp_handle_upload' === $action ? is_uploaded_file( $file['tmp_name'] ) : @is_readable( $file['tmp_name'] );
|
||||
if ( ! $test_uploaded_file ) {
|
||||
return call_user_func_array( $upload_error_handler, array( &$file, __( 'Specified file failed upload test.' ) ) );
|
||||
}
|
||||
@@ -848,10 +849,11 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
|
||||
|
||||
if ( null === $move_new_file ) {
|
||||
if ( 'wp_handle_upload' === $action ) {
|
||||
$move_new_file = @ move_uploaded_file( $file['tmp_name'], $new_file );
|
||||
$move_new_file = @move_uploaded_file( $file['tmp_name'], $new_file );
|
||||
} else {
|
||||
// use copy and unlink because rename breaks streams.
|
||||
$move_new_file = @ copy( $file['tmp_name'], $new_file );
|
||||
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
|
||||
$move_new_file = @copy( $file['tmp_name'], $new_file );
|
||||
unlink( $file['tmp_name'] );
|
||||
}
|
||||
|
||||
@@ -868,7 +870,7 @@ function _wp_handle_upload( &$file, $overrides, $time, $action ) {
|
||||
// Set correct file permissions.
|
||||
$stat = stat( dirname( $new_file ) );
|
||||
$perms = $stat['mode'] & 0000666;
|
||||
@ chmod( $new_file, $perms );
|
||||
chmod( $new_file, $perms );
|
||||
|
||||
// Compute the URL.
|
||||
$url = $uploads['url'] . "/$filename";
|
||||
@@ -1854,7 +1856,7 @@ function get_filesystem_method( $args = array(), $context = '', $allow_relaxed_f
|
||||
$GLOBALS['_wp_filesystem_direct_method'] = 'relaxed_ownership';
|
||||
}
|
||||
|
||||
@fclose( $temp_handle );
|
||||
fclose( $temp_handle );
|
||||
@unlink( $temp_file_name );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user