diff --git a/wp-comments-post.php b/wp-comments-post.php index d6400f1519..0fc2317544 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -32,10 +32,10 @@ if ( empty($status->comment_status) ) { exit; } -$comment_author = trim(strip_tags($_POST['author'])); -$comment_author_email = trim($_POST['email']); -$comment_author_url = trim($_POST['url']); -$comment_content = trim($_POST['comment']); +$comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null; +$comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null; +$comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null; +$comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null; // If the user is logged in $user = wp_get_current_user(); diff --git a/wp-includes/classes.php b/wp-includes/classes.php index e6bebd5d55..0f2680118f 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -1082,8 +1082,9 @@ class Walker { $id_field = $this->db_fields['id']; $id = $e->$id_field; - foreach ( (array)$children_elements[$id] as $child ) - $this->unset_children( $child, $children_elements ); + if ( !empty($children_elements[$id]) && is_array($children_elements[$id]) ) + foreach ( (array) $children_elements[$id] as $child ) + $this->unset_children( $child, $children_elements ); if ( isset($children_elements[$id]) ) unset( $children_elements[$id] );