WordPress.org

Make WordPress Core

Ticket #11637: 11637-php_version.diff

File 11637-php_version.diff, 4.4 KB (added by nacin, 6 years ago)

Forgot to mention in the ticket description that this patch also removes a check for at least 4.3 in wp-db.php.

  • wp-admin/setup-config.php

     
    3737require_once(ABSPATH . WPINC . '/compat.php'); 
    3838require_once(ABSPATH . WPINC . '/functions.php'); 
    3939require_once(ABSPATH . WPINC . '/classes.php'); 
     40require_once(ABSPATH . WPINC . '/version.php'); 
    4041 
    4142if (!file_exists(ABSPATH . 'wp-config-sample.php')) 
    4243        wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); 
     
    5152if (file_exists(ABSPATH . '../wp-config.php') && ! file_exists(ABSPATH . '../wp-settings.php')) 
    5253        wp_die("<p>The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p>"); 
    5354 
    54 if ( version_compare( '4.3', phpversion(), '>' ) ) 
    55         wp_die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) ); 
     55if ( version_compare( $required_php_version, phpversion(), '>' ) ) 
     56        wp_die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %1$s but WordPress requires at least %2$s.'/*/WP_I18N_OLD_PHP*/, phpversion(), $required_php_version ) ); 
    5657 
    5758if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') ) 
    5859        wp_die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 
  • wp-includes/wp-db.php

     
    10921092        /** 
    10931093         * Retrieve the name of the function that called wpdb. 
    10941094         * 
    1095          * Requires PHP 4.3 and searches up the list of functions until it reaches 
     1095         * Searches up the list of functions until it reaches 
    10961096         * the one that would most logically had called this method. 
    10971097         * 
    10981098         * @since 2.5.0 
     
    11001100         * @return string The name of the calling function 
    11011101         */ 
    11021102        function get_caller() { 
    1103                 // requires PHP 4.3+ 
    1104                 if ( !is_callable('debug_backtrace') ) 
    1105                         return ''; 
    1106  
    11071103                $bt = debug_backtrace(); 
    11081104                $caller = array(); 
    11091105 
  • wp-settings.php

     
    105105if ( empty($PHP_SELF) ) 
    106106        $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 
    107107 
    108 if ( version_compare( '4.3', phpversion(), '>' ) ) { 
    109         die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) ); 
    110 } 
    111  
    112108if ( !defined('WP_CONTENT_DIR') ) 
    113109        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 
    114110 
     
    144140        } 
    145141} 
    146142 
    147 if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') ) 
    148         die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 
    149  
    150143/** 
    151144 * PHP 4 standard microtime start capture. 
    152145 * 
     
    265258require (ABSPATH . WPINC . '/compat.php'); 
    266259require (ABSPATH . WPINC . '/functions.php'); 
    267260require (ABSPATH . WPINC . '/classes.php'); 
     261require (ABSPATH . WPINC . '/version.php'); 
    268262 
     263if ( version_compare( $required_php_version, phpversion(), '>' ) ) 
     264        die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %1$s but WordPress requires at least %2$s.'/*/WP_I18N_OLD_PHP*/, phpversion(), $required_php_version ) ); 
     265 
     266if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') ) 
     267        die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 
     268 
    269269require_wp_db(); 
    270270 
    271271if ( !empty($wpdb->error) ) 
     
    377377require (ABSPATH . WPINC . '/bookmark-template.php'); 
    378378require (ABSPATH . WPINC . '/kses.php'); 
    379379require (ABSPATH . WPINC . '/cron.php'); 
    380 require (ABSPATH . WPINC . '/version.php'); 
    381380require (ABSPATH . WPINC . '/deprecated.php'); 
    382381require (ABSPATH . WPINC . '/script-loader.php'); 
    383382require (ABSPATH . WPINC . '/taxonomy.php');