Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #57035


Ignore:
Timestamp:
11/08/2022 01:40:58 PM (2 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #57035

    • Property Keywords has-patch php8 added
    • Property Component changed from General to Date/Time
    • Property Milestone changed from Awaiting Review to 6.2
  • Ticket #57035 – Description

    initial v2  
    55It looks like the function has some typecasting, but it is placed in the wrong spot.
    66
    7 `
     7{{{
    88        // Don't use non-GMT timestamp, unless you know the difference and really need to.
    99        if ( 'timestamp' === $type || 'U' === $type ) {
    1010                return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    1111        }
    12 `
     12}}}
    1313
    1414Should be
    1515
    16 `
     16{{{
    1717        // Don't use non-GMT timestamp, unless you know the difference and really need to.
    1818        if ( 'timestamp' === $type || 'U' === $type ) {
    1919                return $gmt ? time() : time() + ( (int) get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    2020        }
    21 `
     21}}}
    2222
    23 Again, this is potentially an edge case. Another ticket was reported and closed when the user discovered a work around, but I think this fix is pretty simple and will solve for weird edge cases that can break sites in php8.
    24 https://core.trac.wordpress.org/ticket/56358
     23Again, this is potentially an edge case. Another ticket, #56358, was reported and closed when the user discovered a work around, but I think this fix is pretty simple and will solve for weird edge cases that can break sites in php8.