diff --git src/wp-includes/theme.php src/wp-includes/theme.php
index 3c908f1820..b1d85e6f94 100644
|
|
function wp_get_themes( $args = array() ) { |
35 | 35 | |
36 | 36 | $theme_directories = search_theme_directories(); |
37 | 37 | |
38 | | if ( count( $wp_theme_directories ) > 1 ) { |
| 38 | if ( is_array( $wp_theme_directories ) && count( $wp_theme_directories ) > 1 ) { |
39 | 39 | // Make sure the current theme wins out, in case search_theme_directories() picks the wrong |
40 | 40 | // one in the case of a conflict. (Normally, last registered theme root wins.) |
41 | 41 | $current_theme = get_stylesheet(); |
… |
… |
function get_theme_root_uri( $stylesheet_or_template = false, $theme_root = fals |
627 | 627 | function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) { |
628 | 628 | global $wp_theme_directories; |
629 | 629 | |
630 | | if ( count($wp_theme_directories) <= 1 ) |
| 630 | if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { |
631 | 631 | return '/themes'; |
| 632 | } |
632 | 633 | |
633 | 634 | $theme_root = false; |
634 | 635 | |
diff --git tests/phpunit/tests/post/types.php tests/phpunit/tests/post/types.php
index 31a51c2020..3c1210e088 100644
|
|
class Tests_Post_Types extends WP_UnitTestCase { |
423 | 423 | 'public' => true, |
424 | 424 | ) ); |
425 | 425 | |
426 | | $this->assertSame( 1, count( $wp_filter['future_foo'] ) ); |
| 426 | $this->assertArrayHasKey( 'future_foo', $wp_filter ); |
| 427 | $this->assertSame( 1, count( $wp_filter['future_foo']->callbacks ) ); |
427 | 428 | $this->assertTrue( unregister_post_type( 'foo' ) ); |
428 | 429 | $this->assertArrayNotHasKey( 'future_foo', $wp_filter ); |
429 | 430 | } |
… |
… |
class Tests_Post_Types extends WP_UnitTestCase { |
439 | 440 | 'register_meta_box_cb' => '__return_empty_string', |
440 | 441 | ) ); |
441 | 442 | |
442 | | $this->assertSame( 1, count( $wp_filter['add_meta_boxes_foo'] ) ); |
| 443 | $this->assertArrayHasKey( 'add_meta_boxes_foo', $wp_filter ); |
| 444 | $this->assertSame( 1, count( $wp_filter['add_meta_boxes_foo']->callbacks ) ); |
443 | 445 | $this->assertTrue( unregister_post_type( 'foo' ) ); |
444 | 446 | $this->assertArrayNotHasKey( 'add_meta_boxes_foo', $wp_filter ); |
445 | 447 | } |
diff --git tests/phpunit/tests/taxonomy.php tests/phpunit/tests/taxonomy.php
index 252280eef4..b5fd536100 100644
|
|
class Tests_Taxonomy extends WP_UnitTestCase { |
764 | 764 | |
765 | 765 | register_taxonomy( 'foo', 'post' ); |
766 | 766 | |
767 | | $this->assertSame( 1, count( $wp_filter['wp_ajax_add-foo'] ) ); |
| 767 | $this->assertArrayHasKey( 'wp_ajax_add-foo', $wp_filter ); |
| 768 | $this->assertSame( 1, count( $wp_filter['wp_ajax_add-foo']->callbacks ) ); |
768 | 769 | $this->assertTrue( unregister_taxonomy( 'foo' ) ); |
769 | 770 | $this->assertArrayNotHasKey( 'wp_ajax_add-foo', $wp_filter ); |
770 | 771 | } |