Make sure get_pages cache is an array

git-svn-id: http://svn.automattic.com/wordpress/trunk@10226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-12-18 22:26:57 +00:00
parent b117040958
commit 8427b2b756
1 changed files with 5 additions and 1 deletions

View File

@ -2127,14 +2127,18 @@ function &get_pages($args = '') {
$r = wp_parse_args( $args, $defaults ); $r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP ); extract( $r, EXTR_SKIP );
$cache = array();
$key = md5( serialize( compact(array_keys($defaults)) ) ); $key = md5( serialize( compact(array_keys($defaults)) ) );
if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) { if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) {
if ( isset( $cache[ $key ] ) ) { if ( is_array($cache) && isset( $cache[ $key ] ) ) {
$pages = apply_filters('get_pages', $cache[ $key ], $r ); $pages = apply_filters('get_pages', $cache[ $key ], $r );
return $pages; return $pages;
} }
} }
if ( !is_array($cache) )
$cache = array();
$inclusions = ''; $inclusions = '';
if ( !empty($include) ) { if ( !empty($include) ) {
$child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include