Index: trunk/wp-includes/post.php
===================================================================
--- trunk/wp-includes/post.php	(revision 8702)
+++ trunk/wp-includes/post.php	(revision 8732)
@@ -124,6 +124,8 @@
 
 	$children = get_posts( $r );
-	if ( !$children )
-		return false;
+	if ( !$children ) {
+		$kids = false;
+		return $kids;
+	}
 
 	update_post_cache($children);
@@ -777,7 +779,11 @@
 		return $post;
 	if ( is_object($post) ) {
+		if ( !isset($post->ID) )
+			$post->ID = 0;
 		foreach ( array_keys(get_object_vars($post)) as $field )
 			$post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
 	} else {
+		if ( !isset($post['ID']) )
+			$post['ID'] = 0;
 		foreach ( array_keys($post) as $field )
 			$post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
@@ -1317,5 +1323,5 @@
 
 	// Make sure we set a valid category
-	if (0 == count($post_category) || !is_array($post_category)) {
+	if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
 		$post_category = array(get_option('default_category'));
 	}
@@ -1329,4 +1335,6 @@
 	if ( empty($post_type) )
 		$post_type = 'post';
+
+	$post_ID = 0;
 
 	// Get the post ID and GUID
@@ -1433,5 +1441,6 @@
 		}
 	} else {
-		$data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update
+		if ( isset($post_mime_type) )
+			$data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update
 		if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
 			if ( $wp_error )
