[wp-trac] [WordPress Trac] #61908: wp_date does not support micro seconds.

WordPress Trac noreply at wordpress.org
Thu Aug 22 13:29:12 UTC 2024


#61908: wp_date does not support micro seconds.
---------------------------+----------------------
 Reporter:  dpeterson1971  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Date/Time      |     Version:  6.6
 Severity:  normal         |  Resolution:  invalid
 Keywords:                 |     Focuses:
---------------------------+----------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-patch =>
 * milestone:  Awaiting Review =>


Old description:

> // This fails because of this line.
> $date = wp_date('Y-m-d H:i:s.u',microtime( true ));
>
> if ( null === $timestamp ) {
>     $timestamp = time();
> } elseif ( ! is_numeric( $timestamp ) ) {
>     return false;
> }
> // Should be changed to this.
> if ( null === $timestamp ) {
>     $timestamp = time();
> } elseif ( ! is_numeric( $timestamp ) || ! is_float($timestamp) {
>     return false;
> }

New description:

 {{{
 // This fails because of this line.
 $date = wp_date('Y-m-d H:i:s.u',microtime( true ));

 if ( null === $timestamp ) {
     $timestamp = time();
 } elseif ( ! is_numeric( $timestamp ) ) {
     return false;
 }

 // Should be changed to this.
 if ( null === $timestamp ) {
     $timestamp = time();
 } elseif ( ! is_numeric( $timestamp ) || ! is_float($timestamp) {
     return false;
 }
 }}}

--

Comment:

 No worries, thanks for the follow-up!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61908#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list