Changeset 39993 for branches/4.7
- Timestamp:
- 01/26/2017 04:56:21 PM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
-
branches/4.7/src/wp-includes/class-wp-comment.php
r38381 r39993 192 192 global $wpdb; 193 193 194 if ( ! is_numeric( $id ) || $id != floor( $id ) || ! $id ) { 194 $comment_id = (int) $id; 195 if ( ! $comment_id ) { 195 196 return false; 196 197 } 197 198 $comment_id = (int) $id;199 198 200 199 $_comment = wp_cache_get( $comment_id, 'comment' ); -
branches/4.7/src/wp-includes/class-wp-post.php
r38951 r39993 211 211 global $wpdb; 212 212 213 if ( ! is_numeric( $post_id ) || $post_id != floor( $post_id ) || ! $post_id ) { 213 $post_id = (int) $post_id; 214 if ( ! $post_id ) { 214 215 return false; 215 216 } 216 217 $post_id = (int) $post_id;218 217 219 218 $_post = wp_cache_get( $post_id, 'posts' ); -
branches/4.7/src/wp-includes/class-wp-term.php
r38381 r39993 126 126 global $wpdb; 127 127 128 if ( ! is_numeric( $term_id ) || $term_id != floor( $term_id ) || ! $term_id ) { 128 $term_id = (int) $term_id; 129 if ( ! $term_id ) { 129 130 return false; 130 131 } 131 132 $term_id = (int) $term_id;133 132 134 133 $_term = wp_cache_get( $term_id, 'terms' ); -
branches/4.7/tests/phpunit/tests/comment/wpComment.php
r38398 r39993 53 53 * @ticket 37738 54 54 */ 55 public function test_get_instance_should_fail_for_bool() {56 $found = WP_Comment::get_instance( true );57 58 $this->assertFalse( $found );59 }60 61 /**62 * @ticket 3773863 */64 55 public function test_get_instance_should_succeed_for_float_that_is_equal_to_post_id() { 65 56 $found = WP_Comment::get_instance( 1.0 ); … … 67 58 $this->assertEquals( 1, $found->comment_ID ); 68 59 } 69 70 /**71 * @ticket 3773872 */73 public function test_get_instance_should_fail_for_float() {74 $found = WP_Comment::get_instance( 1.6 );75 76 $this->assertFalse( $found );77 }78 79 /**80 * @ticket 3773881 */82 public function test_get_instance_should_fail_for_array() {83 $found = WP_Comment::get_instance( array( 1 ) );84 85 $this->assertFalse( $found );86 }87 88 /**89 * @ticket 3773890 */91 public function test_get_instance_should_fail_for_class() {92 $class = new stdClass();93 $found = WP_Comment::get_instance( $class );94 95 $this->assertFalse( $found );96 }97 60 } -
branches/4.7/tests/phpunit/tests/post/wpPost.php
r38398 r39993 51 51 * @ticket 37738 52 52 */ 53 public function test_get_instance_should_fail_for_bool() {54 $found = WP_Post::get_instance( true );55 56 $this->assertFalse( $found );57 }58 59 /**60 * @ticket 3773861 */62 53 public function test_get_instance_should_succeed_for_float_that_is_equal_to_post_id() { 63 54 $found = WP_Post::get_instance( 1.0 ); … … 65 56 $this->assertSame( 1, $found->ID ); 66 57 } 67 68 /**69 * @ticket 3773870 */71 public function test_get_instance_should_fail_for_float() {72 $found = WP_Post::get_instance( 1.6 );73 74 $this->assertFalse( $found );75 }76 77 /**78 * @ticket 3773879 */80 public function test_get_instance_should_fail_for_array() {81 $found = WP_Post::get_instance( array( 1 ) );82 83 $this->assertFalse( $found );84 }85 86 /**87 * @ticket 3773888 */89 public function test_get_instance_should_fail_for_class() {90 $class = new stdClass();91 $found = WP_Post::get_instance( $class );92 93 $this->assertFalse( $found );94 }95 58 } -
branches/4.7/tests/phpunit/tests/term/wpTerm.php
r38398 r39993 64 64 * @ticket 37738 65 65 */ 66 public function test_get_instance_should_fail_for_bool() {67 $found = WP_Term::get_instance( true );68 69 $this->assertFalse( $found );70 }71 72 /**73 * @ticket 3773874 */75 66 public function test_get_instance_should_succeed_for_float_that_is_equal_to_post_id() { 76 67 $found = WP_Term::get_instance( 1.0 ); … … 78 69 $this->assertSame( 1, $found->term_id ); 79 70 } 80 81 /**82 * @ticket 3773883 */84 public function test_get_instance_should_fail_for_float() {85 $found = WP_Term::get_instance( 1.6 );86 87 $this->assertFalse( $found );88 }89 90 /**91 * @ticket 3773892 */93 public function test_get_instance_should_fail_for_array() {94 $found = WP_Term::get_instance( array( 1 ) );95 96 $this->assertFalse( $found );97 }98 99 /**100 * @ticket 37738101 */102 public function test_get_instance_should_fail_for_class() {103 $class = new stdClass();104 $found = WP_Term::get_instance( $class );105 106 $this->assertFalse( $found );107 }108 71 }
Note: See TracChangeset
for help on using the changeset viewer.