[wp-trac] [WordPress Trac] #51184: get_the_date() checks $format only for emtpy variable and fails on false boolean - since WP 5.5
WordPress Trac
noreply at wordpress.org
Fri Aug 28 22:05:09 UTC 2020
#51184: get_the_date() checks $format only for emtpy variable and fails on false
boolean - since WP 5.5
--------------------------+-----------------------------
Reporter: wittich | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Date/Time | Version: 5.5
Severity: normal | Keywords: needs-patch
Focuses: |
--------------------------+-----------------------------
Just run over a bug which was generated in WordPress 5.5, before it was
working fine.
The function get_the_date() in the general-template.php is now comparing
only for empty string and ignores a $format = false;
Compare https://github.com/WordPress/WordPress/blob/5.4-branch/wp-includes
/general-template.php#L2531 vs.
https://github.com/WordPress/WordPress/blob/5.5-branch/wp-includes
/general-template.php#L2528
I think the correct solution would be something like that:
{{{#!php
if ( '' === $format || false === $format )
}}}
Here is how to test the case
{{{#!php
echo get_the_date( get_option( 'date_time' ) );
// Output: ""
}}}
This should output the date and not an empty result. The options
'date_time' doesn't exist.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51184>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list