Prophylactic casting.

git-svn-id: http://svn.automattic.com/wordpress/trunk@5022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-03-10 20:34:01 +00:00
parent 98e4d11c00
commit 239b5ba356

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?