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
This commit is contained in:
ryan 2009-11-18 21:52:38 +00:00
parent 039a004122
commit 47001b4c43
2 changed files with 9 additions and 13 deletions

View File

@ -624,8 +624,6 @@ function wp_dashboard_incoming_links_output() {
printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
echo '</p>';
}
$rss->__destruct();
unset($rss);
return;
}
@ -742,8 +740,6 @@ function wp_dashboard_secondary_output() {
printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
echo '</p></div>';
}
$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 );
}

View File

@ -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 '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
$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' );