From 3e2783acdd559d1a69a44d586c6a074b17059474 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 22 Mar 2007 23:03:07 +0000 Subject: [PATCH] Cast to int git-svn-id: https://develop.svn.wordpress.org/trunk@5086 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index aa5b7ef917..a3c50f4289 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -460,6 +460,7 @@ function wp_get_recent_posts($num = 10) { global $wpdb; // Set the limit clause, if we got a limit + $num = (int) $num; if ($num) { $limit = "LIMIT $num"; } @@ -770,6 +771,8 @@ function wp_publish_post($post_id) { function wp_set_post_categories($post_ID = 0, $post_categories = array()) { global $wpdb; + + $post_ID = (int) $post_ID; // If $post_categories isn't already an array, make it one: if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories)) $post_categories = array(get_option('default_category')); @@ -780,7 +783,7 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) { $old_categories = $wpdb->get_col(" SELECT category_id FROM $wpdb->post2cat - WHERE post_id = $post_ID"); + WHERE post_id = '$post_ID'"); if (!$old_categories) { $old_categories = array(); @@ -795,8 +798,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) { foreach ($delete_cats as $del) { $wpdb->query(" DELETE FROM $wpdb->post2cat - WHERE category_id = $del - AND post_id = $post_ID + WHERE category_id = '$del' + AND post_id = '$post_ID' "); } }