Forum Replies Created

Viewing 1 replies (of 1 total)
  • It appears to have broken time reporting functionality from 2.2.0 in WordPress < 3.9.

    2.2.1 reports 1970 dates despite records in database being correct.
    2.2.0 reports correct dates but incorrect times.

    See current_time in functions, expects argument 1 $type as string [“mysql”|”timezone”]: and does not have default added until 3.9
    https://github.com/WordPress/WordPress/commit/237941babc69a7f4f04b262092096ea120b0bfdb

    Emulated behavior: https://ideone.com/usjocW

    /* /plugins/leadin/inc/leadin-functions.php:872 */
    strtotime(current_time('Y-m-d H:i:s'));
    /* /wp-includes/functions.php */
    function current_time( $type, $gmt = 0 ) {
    	switch ( $type ) {
    		case 'mysql':
    			return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );
    			break;
    		case 'timestamp':
    			return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
    			break;
    	}
    }

    Used correctly in

    /* /wp/includes/admin/leadin-admin.php:256 */
    $this->leadin_header('Leadin Stats: ' . date('F j Y, g:ia', current_time('timestamp')), 'leadin-stats__header');

Viewing 1 replies (of 1 total)