Bail early when invalid ID is passed to get_comment_class().

This helps to avoid PHP notices later in the function.

Props walterebert, dipesh.kakadiya, DrewAPicture.
Fixes #33947.

git-svn-id: https://develop.svn.wordpress.org/trunk@34454 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-09-23 14:08:47 +00:00
parent b23a1fc613
commit e6b7c6b2d4
2 changed files with 12 additions and 2 deletions

View File

@@ -36,4 +36,11 @@ class Tests_Comment_GetCommentClass extends WP_UnitTestCase {
$this->assertContains( 'foo', $classes );
$this->assertContains( 'bar', $classes );
}
/**
* @ticket 33947
*/
public function test_should_return_an_empty_array_for_invalid_comment_id() {
$this->assertSame( array(), get_comment_class( 'foo', 12345 ) );
}
}