Make WordPress Core


Ignore:
Timestamp:
05/26/2019 12:11:37 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Date/Time: Replace all instances of date() with gmdate().

Use of date() in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

gmdate() is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r44785 r45424  
    14291429        $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    14301430
    1431         $year_month      = date( 'Y/m' );
     1431        $year_month      = gmdate( 'Y/m' );
    14321432        $image_meta      = wp_get_attachment_metadata( self::$large_id );
    14331433        $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/';
     
    15511551        $_wp_additional_image_sizes = wp_get_additional_image_sizes();
    15521552
    1553         $year_month      = date( 'Y/m' );
     1553        $year_month      = gmdate( 'Y/m' );
    15541554        $image_meta      = wp_get_attachment_metadata( self::$large_id );
    15551555        $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/';
     
    18321832        $srcset = wp_get_attachment_image_srcset( self::$large_id, $size_array, $image_meta );
    18331833
    1834         $year_month  = date( 'Y/m' );
     1834        $year_month  = gmdate( 'Y/m' );
    18351835        $uploads_dir = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/';
    18361836
     
    22292229
    22302230        $actual = wp_get_attachment_image( self::$large_id, 'testsize' );
    2231         $year   = date( 'Y' );
    2232         $month  = date( 'm' );
     2231        $year   = gmdate( 'Y' );
     2232        $month  = gmdate( 'm' );
    22332233
    22342234        $expected = '<img width="999" height="999" src="http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year . '/' . $month . '/test-image-testsize-999x999.png"' .
Note: See TracChangeset for help on using the changeset viewer.