Skip to content

Commit

Permalink
Cast to int
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/branches/2.1@5083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Mar 22, 2007
1 parent 20fe715 commit 06b5e2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions wp-includes/category-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
function get_the_category($id = false) {
global $post, $category_cache, $blog_id;

$id = (int) $id;
if ( !$id )
$id = $post->ID;

Expand Down
5 changes: 5 additions & 0 deletions wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ function wp_delete_post($postid = 0) {
}

function wp_get_post_categories($post_id = 0) {
$post_id = (int) $post_id;

$cats = &get_the_category($post_id);
$cat_ids = array();
foreach ( $cats as $cat )
Expand All @@ -458,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";
}
Expand All @@ -471,6 +474,8 @@ function wp_get_recent_posts($num = 10) {
function wp_get_single_post($postid = 0, $mode = OBJECT) {
global $wpdb;

$postid = (int) $postid;

$post = get_post($postid, $mode);

// Set categories
Expand Down
4 changes: 2 additions & 2 deletions xmlrpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ function blogger_editPost($args) {

$this->escape($args);

$post_ID = $args[1];
$post_ID = (int) $args[1];
$user_login = $args[2];
$user_pass = $args[3];
$content = $args[4];
Expand Down Expand Up @@ -600,7 +600,7 @@ function mw_editPost($args) {

$this->escape($args);

$post_ID = $args[0];
$post_ID = (int) $args[0];
$user_login = $args[1];
$user_pass = $args[2];
$content_struct = $args[3];
Expand Down

0 comments on commit 06b5e2c

Please sign in to comment.