Prophylactic casting.

git-svn-id: https://develop.svn.wordpress.org/trunk@5022 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-03-10 20:34:01 +00:00
parent 9331f3efea
commit a89ea3e725
1 changed files with 2 additions and 0 deletions

View File

@ -105,6 +105,7 @@ function &get_post(&$post, $output = OBJECT) {
$post_cache[$blog_id][$post->ID] = &$post; $post_cache[$blog_id][$post->ID] = &$post;
$_post = & $post_cache[$blog_id][$post->ID]; $_post = & $post_cache[$blog_id][$post->ID];
} else { } else {
$post = (int) $post;
if ( isset($post_cache[$blog_id][$post]) ) if ( isset($post_cache[$blog_id][$post]) )
$_post = & $post_cache[$blog_id][$post]; $_post = & $post_cache[$blog_id][$post];
elseif ( $_post = wp_cache_get($post, 'pages') ) elseif ( $_post = wp_cache_get($post, 'pages') )
@ -930,6 +931,7 @@ function &get_page(&$page, $output = OBJECT) {
wp_cache_add($page->ID, $page, 'pages'); wp_cache_add($page->ID, $page, 'pages');
$_page = $page; $_page = $page;
} else { } else {
$page = (int) $page;
// first, check the cache // first, check the cache
if ( ! ( $_page = wp_cache_get($page, 'pages') ) ) { if ( ! ( $_page = wp_cache_get($page, 'pages') ) ) {
// not in the page cache? // not in the page cache?