Changeset 52828
- Timestamp:
- 03/07/2022 02:42:49 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r52812 r52828 2608 2608 case 'html5': 2609 2609 // You can't just pass 'html5', you need to pass an array of types. 2610 if ( empty( $args[0] ) ) { 2611 // Build an array of types for back-compat. 2612 $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) ); 2613 } elseif ( ! isset( $args[0] ) || ! is_array( $args[0] ) ) { 2610 if ( empty( $args[0] ) || ! is_array( $args[0] ) ) { 2614 2611 _doing_it_wrong( 2615 2612 "add_theme_support( 'html5' )", … … 2617 2614 '3.6.1' 2618 2615 ); 2619 return false; 2616 2617 if ( ! empty( $args[0] ) && ! is_array( $args[0] ) ) { 2618 return false; 2619 } 2620 2621 // Build an array of types for back-compat. 2622 $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) ); 2620 2623 } 2621 2624 -
trunk/tests/phpunit/tests/theme/support.php
r52812 r52828 77 77 /** 78 78 * @ticket 24932 79 * 80 * @expectedIncorrectUsage add_theme_support( 'html5' ) 79 81 */ 80 82 public function test_supports_html5() { … … 82 84 $this->assertFalse( current_theme_supports( 'html5' ) ); 83 85 $this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) ); 86 87 /* 88 * If the second parameter is not specified, it should throw a _doing_it_wrong() notice 89 * and fall back to `array( 'comment-list', 'comment-form', 'search-form' )` for back-compat. 90 */ 84 91 $this->assertNotFalse( add_theme_support( 'html5' ) ); 85 92 $this->assertTrue( current_theme_supports( 'html5' ) ); … … 99 106 $this->assertFalse( current_theme_supports( 'html5' ) ); 100 107 $this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) ); 108 109 // The second parameter should be an array. 101 110 $this->assertFalse( add_theme_support( 'html5', 'comment-form' ) ); 102 111 $this->assertNotFalse( add_theme_support( 'html5', array( 'comment-form' ) ) );
Note: See TracChangeset
for help on using the changeset viewer.