Make WordPress Core

Changes between Version 2 and Version 3 of Ticket #54149, comment 9


Ignore:
Timestamp:
11/05/2021 01:44:22 AM (2 years ago)
Author:
dd32
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #54149, comment 9

    v2 v3  
    2828
    2929That just re-enforces this to me, having to do `if ( $comment instanceOf WP_Comment || ( is_array( $comment ) && ! empty( $comment ) ) ) {}` is ridiculous, when if you trust those who use the filters, `if ( $comment ) {}` is far more readable and "safe"
     30
     31(edit: To be clear though, I agree that the above is an over-the-top.. if you request a object from `get_comment()` it should return an object, but there's no filtering in the function to ensure the object it returns is a WP_Comment or even an object after the filter has been run)