Ticket #51184: 51184.patch
File 51184.patch, 3.5 KB (added by , 4 years ago) |
---|
-
src/wp-includes/comment-template.php
544 544 * @since 1.5.0 545 545 * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. 546 546 * 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. 548 548 * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date. 549 549 * Default current comment. 550 550 * @return string The comment's date. … … 552 552 function get_comment_date( $format = '', $comment_ID = 0 ) { 553 553 $comment = get_comment( $comment_ID ); 554 554 555 if ( '' === $format ) {555 if ( is_string( $format ) && '' !== $format ) { 556 556 $date = mysql2date( get_option( 'date_format' ), $comment->comment_date ); 557 557 } else { 558 558 $date = mysql2date( $format, $comment->comment_date ); … … 1035 1035 * 1036 1036 * @since 1.5.0 1037 1037 * 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. 1039 1039 * @param bool $gmt Optional. Whether to use the GMT date. Default false. 1040 1040 * @param bool $translate Optional. Whether to translate the time (for use in feeds). 1041 1041 * Default true. … … 1046 1046 1047 1047 $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; 1048 1048 1049 if ( '' === $format ) {1049 if ( is_string( $format ) && '' !== $format ) { 1050 1050 $date = mysql2date( get_option( 'time_format' ), $comment_date, $translate ); 1051 1051 } else { 1052 1052 $date = mysql2date( $format, $comment_date, $translate ); -
src/wp-includes/general-template.php
2514 2514 * 2515 2515 * @since 3.0.0 2516 2516 * 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. 2518 2518 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. 2519 2519 * @return string|false Date the current post was written. False on failure. 2520 2520 */ … … 2525 2525 return false; 2526 2526 } 2527 2527 2528 if ( '' === $format ) {2528 if ( is_string( $format ) && '' !== $format ) { 2529 2529 $the_date = get_post_time( get_option( 'date_format' ), false, $post, true ); 2530 2530 } else { 2531 2531 $the_date = get_post_time( $format, false, $post, true ); … … 2640 2640 * 2641 2641 * @since 1.5.0 2642 2642 * 2643 * @param string $format Optional. Format to use for retrieving the time the post2643 * @param string|false $format Optional. Format to use for retrieving the time the post 2644 2644 * was written. Either 'G', 'U', or PHP date format defaults 2645 2645 * to the value specified in the time_format option. Default empty. 2646 2646 * @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object. … … 2654 2654 return false; 2655 2655 } 2656 2656 2657 if ( '' === $format ) {2657 if ( is_string( $format ) && '' !== $format ) { 2658 2658 $the_time = get_post_time( get_option( 'time_format' ), false, $post, true ); 2659 2659 } else { 2660 2660 $the_time = get_post_time( $format, false, $post, true );