Ticket #10332: functions.php.2.diff

File functions.php.2.diff, 943 bytes (added by gosunatxrea, 3 years ago)

use version_compare

  • wp-includes/functions.php

    old new  
    8686function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { 
    8787        global $wp_locale; 
    8888        $i = $unixtimestamp; 
    89         // Sanity check for PHP 5.1.0- 
    90         if ( false === $i || intval($i) < 0 ) { 
    91                 if ( ! $gmt ) 
    92                         $i = current_time( 'timestamp' ); 
    93                 else 
    94                         $i = time(); 
    95                 // we should not let date() interfere with our 
    96                 // specially computed timestamp 
    97                 $gmt = true; 
     89 
     90        if (version_compare( '5.1.0', phpversion(), '>=' )) { 
     91                // Sanity check for PHP 5.1.0- 
     92                if ( false === $i || intval($i) < 0 ) { 
     93                        if ( ! $gmt ) 
     94                                $i = current_time( 'timestamp' ); 
     95                        else 
     96                                $i = time(); 
     97                        // we should not let date() interfere with our 
     98                        // specially computed timestamp 
     99                        $gmt = true; 
     100                } 
    98101        } 
    99102 
    100103        // store original value for language with untypical grammars