From 47001b4c43cd94fe4d0a36615ce35d426ac6a066 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 18 Nov 2009 21:52:38 +0000 Subject: [PATCH] Don't destruct if WP_Error. Props scribu. fixes #11168 git-svn-id: http://svn.automattic.com/wordpress/trunk@12209 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/dashboard.php | 15 ++++++--------- wp-includes/default-widgets.php | 7 +++---- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 89609adbf..aea313277 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -624,8 +624,6 @@ function wp_dashboard_incoming_links_output() { printf(__('RSS Error: %s'), $rss->get_error_message()); echo '

'; } - $rss->__destruct(); - unset($rss); return; } @@ -742,8 +740,6 @@ function wp_dashboard_secondary_output() { printf(__('RSS Error: %s'), $rss->get_error_message()); echo '

'; } - $rss->__destruct(); - unset($rss); } elseif ( !$rss->get_item_quantity() ) { $rss->__destruct(); unset($rss); @@ -932,12 +928,13 @@ function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { // title is optional. If black, fill it if possible if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { $rss = fetch_feed($widget_options[$widget_id]['url']); - if ( ! is_wp_error($rss) ) - $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); - else + if ( is_wp_error($rss) ) { $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed')); - $rss->__destruct(); - unset($rss); + } else { + $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); + $rss->__destruct(); + unset($rss); + } } update_option( 'dashboard_widget_options', $widget_options ); } diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index a0cc15a23..d5c4e39ae 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -772,8 +772,6 @@ function wp_widget_rss_output( $rss, $args = array() ) { if ( is_wp_error($rss) ) { if ( is_admin() || current_user_can('manage_options') ) echo '

' . sprintf( __('RSS Error: %s'), $rss->get_error_message() ) . '

'; - $rss->__destruct(); - unset($rss); return; } @@ -953,9 +951,10 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) { $link = esc_url(strip_tags($rss->get_permalink())); while ( stristr($link, 'http') != $link ) $link = substr($link, 1); + + $rss->__destruct(); + unset($rss); } - $rss->__destruct(); - unset($rss); } return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' );