Make WordPress Core

Ticket #51184: 51184.patch

File 51184.patch, 3.5 KB (added by akabarikalpesh, 4 years ago)

I added patch for general-template.php and comment-template.php

  • src/wp-includes/comment-template.php

     
    544544 * @since 1.5.0
    545545 * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
    546546 *
    547  * @param string         $format     Optional. The format of the date. Default user's setting.
     547 * @param string|false         $format     Optional. The format of the date. Default user's setting.
    548548 * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date.
    549549 *                                   Default current comment.
    550550 * @return string The comment's date.
     
    552552function get_comment_date( $format = '', $comment_ID = 0 ) {
    553553        $comment = get_comment( $comment_ID );
    554554
    555         if ( '' === $format ) {
     555        if ( is_string( $format ) && '' !== $format ) {
    556556                $date = mysql2date( get_option( 'date_format' ), $comment->comment_date );
    557557        } else {
    558558                $date = mysql2date( $format, $comment->comment_date );
     
    10351035 *
    10361036 * @since 1.5.0
    10371037 *
    1038  * @param string $format    Optional. The format of the time. Default user's settings.
     1038 * @param string|false $format    Optional. The format of the time. Default user's settings.
    10391039 * @param bool   $gmt       Optional. Whether to use the GMT date. Default false.
    10401040 * @param bool   $translate Optional. Whether to translate the time (for use in feeds).
    10411041 *                          Default true.
     
    10461046
    10471047        $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date;
    10481048
    1049         if ( '' === $format ) {
     1049        if ( is_string( $format ) && '' !== $format ) {
    10501050                $date = mysql2date( get_option( 'time_format' ), $comment_date, $translate );
    10511051        } else {
    10521052                $date = mysql2date( $format, $comment_date, $translate );
  • src/wp-includes/general-template.php

     
    25142514 *
    25152515 * @since 3.0.0
    25162516 *
    2517  * @param string      $format Optional. PHP date format defaults to the date_format option if not specified.
     2517 * @param string|false      $format Optional. PHP date format defaults to the date_format option if not specified.
    25182518 * @param int|WP_Post $post   Optional. Post ID or WP_Post object. Default current post.
    25192519 * @return string|false Date the current post was written. False on failure.
    25202520 */
     
    25252525                return false;
    25262526        }
    25272527
    2528         if ( '' === $format ) {
     2528        if ( is_string( $format ) && '' !== $format ) {
    25292529                $the_date = get_post_time( get_option( 'date_format' ), false, $post, true );
    25302530        } else {
    25312531                $the_date = get_post_time( $format, false, $post, true );
     
    26402640 *
    26412641 * @since 1.5.0
    26422642 *
    2643  * @param string      $format Optional. Format to use for retrieving the time the post
     2643 * @param string|false      $format Optional. Format to use for retrieving the time the post
    26442644 *                            was written. Either 'G', 'U', or PHP date format defaults
    26452645 *                            to the value specified in the time_format option. Default empty.
    26462646 * @param int|WP_Post $post   WP_Post object or ID. Default is global `$post` object.
     
    26542654                return false;
    26552655        }
    26562656
    2657         if ( '' === $format ) {
     2657        if ( is_string( $format ) && '' !== $format ) {
    26582658                $the_time = get_post_time( get_option( 'time_format' ), false, $post, true );
    26592659        } else {
    26602660                $the_time = get_post_time( $format, false, $post, true );