Changeset 56238
- Timestamp:
- 07/15/2023 09:02:37 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/load.php (modified) (30 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/load.php
r56232 r56238 15 15 function wp_get_server_protocol() { 16 16 $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : ''; 17 17 18 if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) { 18 19 $protocol = 'HTTP/1.0'; 19 20 } 21 20 22 return $protocol; 21 23 } … … 59 61 // Some IIS + PHP configurations put the script-name in the path-info (no need to append it twice). 60 62 if ( isset( $_SERVER['PATH_INFO'] ) ) { 61 if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) {63 if ( $_SERVER['PATH_INFO'] === $_SERVER['SCRIPT_NAME'] ) { 62 64 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; 63 65 } else { … … 148 150 function wp_check_php_mysql_versions() { 149 151 global $required_php_version, $wp_version; 152 150 153 $php_version = PHP_VERSION; 151 154 … … 166 169 $wp_content_dir = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content'; 167 170 168 if ( ! function_exists( 'mysqli_connect' ) 169 && ! function_exists( 'mysql_connect' ) 171 if ( ! function_exists( 'mysqli_connect' ) && ! function_exists( 'mysql_connect' ) 170 172 && ! file_exists( $wp_content_dir . '/db.php' ) 171 173 ) { … … 308 310 '', 309 311 ); 312 310 313 if ( ! in_array( $development_mode, $valid_modes, true ) ) { 311 314 $development_mode = ''; … … 409 412 410 413 require ABSPATH . '.maintenance'; 414 411 415 // If the $upgrading timestamp is older than 10 minutes, consider maintenance over. 412 416 if ( ( time() - $upgrading ) >= 10 * MINUTE_IN_SECONDS ) { … … 460 464 function timer_start() { 461 465 global $timestart; 466 462 467 $timestart = microtime( true ); 468 463 469 return true; 464 470 } … … 481 487 function timer_stop( $display = 0, $precision = 3 ) { 482 488 global $timestart, $timeend; 489 483 490 $timeend = microtime( true ); 484 491 $timetotal = $timeend - $timestart; 485 $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); 492 493 if ( function_exists( 'number_format_i18n' ) ) { 494 $r = number_format_i18n( $timetotal, $precision ); 495 } else { 496 $r = number_format( $timetotal, $precision ); 497 } 498 486 499 if ( $display ) { 487 500 echo $r; 488 501 } 502 489 503 return $r; 490 504 } … … 582 596 } 583 597 584 if ( 585 defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || defined( 'MS_FILES_REQUEST' ) ||586 ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) ||587 wp_doing_ajax() || wp_is_json_request()) {598 if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || defined( 'MS_FILES_REQUEST' ) 599 || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) 600 || wp_doing_ajax() || wp_is_json_request() 601 ) { 588 602 ini_set( 'display_errors', 0 ); 589 603 } … … 605 619 function wp_set_lang_dir() { 606 620 if ( ! defined( 'WP_LANG_DIR' ) ) { 607 if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || ! @is_dir( ABSPATH . WPINC . '/languages' ) ) { 621 if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) 622 || ! @is_dir( ABSPATH . WPINC . '/languages' ) 623 ) { 608 624 /** 609 625 * Server path of the language directory. … … 614 630 */ 615 631 define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); 632 616 633 if ( ! defined( 'LANGDIR' ) ) { 617 634 // Old static relative path maintained for limited backward compatibility - won't work in some cases. … … 627 644 */ 628 645 define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); 646 629 647 if ( ! defined( 'LANGDIR' ) ) { 630 648 // Old relative path maintained for backward compatibility. … … 677 695 function wp_set_wpdb_vars() { 678 696 global $wpdb, $table_prefix; 697 679 698 if ( ! empty( $wpdb->error ) ) { 680 699 dead_db(); … … 747 766 function wp_using_ext_object_cache( $using = null ) { 748 767 global $_wp_using_ext_object_cache; 768 749 769 $current_using = $_wp_using_ext_object_cache; 770 750 771 if ( null !== $using ) { 751 772 $_wp_using_ext_object_cache = $using; 752 773 } 774 753 775 return $current_using; 754 776 } … … 794 816 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 795 817 require_once WP_CONTENT_DIR . '/object-cache.php'; 818 796 819 if ( function_exists( 'wp_cache_init' ) ) { 797 820 wp_using_ext_object_cache( true ); … … 904 927 function wp_get_mu_plugins() { 905 928 $mu_plugins = array(); 929 906 930 if ( ! is_dir( WPMU_PLUGIN_DIR ) ) { 907 931 return $mu_plugins; 908 932 } 933 909 934 $dh = opendir( WPMU_PLUGIN_DIR ); 910 935 if ( ! $dh ) { 911 936 return $mu_plugins; 912 937 } 938 913 939 while ( ( $plugin = readdir( $dh ) ) !== false ) { 914 940 if ( '.php' === substr( $plugin, -4 ) ) { … … 916 942 } 917 943 } 944 918 945 closedir( $dh ); 946 919 947 sort( $mu_plugins ); 920 948 … … 958 986 // Not already included as a network plugin. 959 987 && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins, true ) ) 960 ) {988 ) { 961 989 $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; 962 990 } … … 1387 1415 function get_current_blog_id() { 1388 1416 global $blog_id; 1417 1389 1418 return absint( $blog_id ); 1390 1419 } … … 1429 1458 function wp_load_translations_early() { 1430 1459 global $wp_textdomain_registry, $wp_locale; 1431 1432 1460 static $loaded = false; 1461 1433 1462 if ( $loaded ) { 1434 1463 return; 1435 1464 } 1465 1436 1466 $loaded = true; 1437 1467 … … 1502 1532 if ( file_exists( $location . '/' . $locale . '.mo' ) ) { 1503 1533 load_textdomain( 'default', $location . '/' . $locale . '.mo', $locale ); 1534 1504 1535 if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) ) { 1505 1536 load_textdomain( 'default', $location . '/admin-' . $locale . '.mo', $locale ); 1506 1537 } 1538 1507 1539 break 2; 1508 1540 } … … 1539 1571 $old_installing = $installing; 1540 1572 $installing = $is_installing; 1573 1541 1574 return (bool) $old_installing; 1542 1575 } … … 1559 1592 } 1560 1593 1561 if ( '1' == $_SERVER['HTTPS'] ) {1594 if ( '1' === (string) $_SERVER['HTTPS'] ) { 1562 1595 return true; 1563 1596 } 1564 } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {1597 } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' === (string) $_SERVER['SERVER_PORT'] ) ) { 1565 1598 return true; 1566 1599 } 1600 1567 1601 return false; 1568 1602 } … … 1618 1652 1619 1653 // Bit operator to workaround https://bugs.php.net/bug.php?id=44936 which changes access level to 63 in PHP 5.2.6 - 5.2.17. 1620 if ( isset( $ini_all[ $setting ]['access'] ) && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) ) { 1654 if ( isset( $ini_all[ $setting ]['access'] ) 1655 && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) 1656 ) { 1621 1657 return true; 1622 1658 } … … 1740 1776 return; 1741 1777 } 1778 1742 1779 $key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 ); 1743 1780 $nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] ); … … 1754 1791 die(); 1755 1792 } 1793 1756 1794 if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) { 1757 1795 define( 'WP_SANDBOX_SCRAPING', true ); 1758 1796 } 1797 1759 1798 register_shutdown_function( 'wp_finalize_scraping_edited_file_errors', $key ); 1760 1799 } … … 1769 1808 function wp_finalize_scraping_edited_file_errors( $scrape_key ) { 1770 1809 $error = error_get_last(); 1810 1771 1811 echo "\n###### wp_scraping_result_start:$scrape_key ######\n"; 1772 if ( ! empty( $error ) && in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) { 1812 1813 if ( ! empty( $error ) 1814 && in_array( $error['type'], array( E_CORE_ERROR, E_COMPILE_ERROR, E_ERROR, E_PARSE, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) 1815 ) { 1773 1816 $error = str_replace( ABSPATH, '', $error ); 1774 1817 echo wp_json_encode( $error ); … … 1776 1819 echo wp_json_encode( true ); 1777 1820 } 1821 1778 1822 echo "\n###### wp_scraping_result_end:$scrape_key ######\n"; 1779 1823 } … … 1788 1832 */ 1789 1833 function wp_is_json_request() { 1790 1791 1834 if ( isset( $_SERVER['HTTP_ACCEPT'] ) && wp_is_json_media_type( $_SERVER['HTTP_ACCEPT'] ) ) { 1792 1835 return true; … … 1798 1841 1799 1842 return false; 1800 1801 1843 } 1802 1844
Note: See TracChangeset
for help on using the changeset viewer.