General: Fix code quality issues which were identified by static analysis.

This fixes minor issues that could cause PHP notices under the right conditions, and fixes some general incorrectness.

Props jrf, hellofromTonya for review

See #52217

Built from https://develop.svn.wordpress.org/trunk@51850


git-svn-id: http://core.svn.wordpress.org/trunk@51449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2021-09-22 21:01:00 +00:00
parent a016bf3172
commit 07f3c35467
9 changed files with 22 additions and 8 deletions

View File

@ -154,7 +154,7 @@ if ( $doaction ) {
}
$sendback = add_query_arg( 'untrashed', $untrashed, $sendback );
remove_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10, 3 );
remove_filter( 'wp_untrash_post_status', 'wp_untrash_post_set_previous_status', 10 );
break;
case 'delete':

View File

@ -207,12 +207,14 @@ class WP_List_Table {
* @since 4.0.0
*
* @param string $name Property to check if set.
* @return bool Whether the property is set.
* @return bool Whether the property is a back-compat property and it is set.
*/
public function __isset( $name ) {
if ( in_array( $name, $this->compat_fields, true ) ) {
return isset( $this->$name );
}
return false;
}
/**
@ -313,6 +315,8 @@ class WP_List_Table {
if ( isset( $this->_pagination_args[ $key ] ) ) {
return $this->_pagination_args[ $key ];
}
return 0;
}
/**

View File

@ -307,7 +307,7 @@ class WP_Http_Curl {
);
// Handle redirects.
$redirect_response = WP_HTTP::handle_redirects( $url, $parsed_args, $response );
$redirect_response = WP_Http::handle_redirects( $url, $parsed_args, $response );
if ( false !== $redirect_response ) {
return $redirect_response;
}

View File

@ -470,6 +470,6 @@ class WP_Http_Streams {
* @since 2.7.0
* @deprecated 3.7.0 Please use WP_HTTP::request() directly
*/
class WP_HTTP_Fsockopen extends WP_HTTP_Streams {
class WP_HTTP_Fsockopen extends WP_Http_Streams {
// For backward compatibility for users who are using the class directly.
}

View File

@ -5506,6 +5506,8 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
if ( $foundid ) {
return get_post( $foundid, $output );
}
return null;
}
/**
@ -5563,6 +5565,8 @@ function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' )
if ( $page ) {
return get_post( $page, $output );
}
return null;
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51849';
$wp_version = '5.9-alpha-51850';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -1739,11 +1739,12 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
$show_summary = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0;
$show_author = isset( $widget_rss['show_author'] ) ? (int) $widget_rss['show_author'] : 0;
$show_date = isset( $widget_rss['show_date'] ) ? (int) $widget_rss['show_date'] : 0;
$error = false;
$link = '';
if ( $check_feed ) {
$rss = fetch_feed( $url );
$error = false;
$link = '';
if ( is_wp_error( $rss ) ) {
$error = $rss->get_error_message();
} else {

View File

@ -53,6 +53,8 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
}
}
$default_title = $title;
$show_count = ! empty( $instance['count'] );
$tag_cloud = wp_tag_cloud(

View File

@ -77,6 +77,9 @@ for ( $i = 1; $i <= $count; $i++ ) {
$content_transfer_encoding = '';
$post_author = 1;
$author_found = false;
$post_date = null;
$post_date_gmt = null;
foreach ( $message as $line ) {
// Body signal.
if ( strlen( $line ) < 3 ) {