Make WordPress Core


Ignore:
Timestamp:
09/23/2015 09:56:32 PM (9 years ago)
Author:
johnbillion
Message:

Send a 500 HTTP response code when the server's PHP or MySQL checks fail.

Fixes #33689
Props jeichorn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r34291 r34462  
    112112    if ( version_compare( $required_php_version, $php_version, '>' ) ) {
    113113        wp_load_translations_early();
     114
     115        $protocol = $_SERVER['SERVER_PROTOCOL'];
     116        if ( 'HTTP/1.1' !== $protocol && 'HTTP/1.0' !== $protocol ) {
     117            $protocol = 'HTTP/1.0';
     118        }
     119        header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
    114120        header( 'Content-Type: text/html; charset=utf-8' );
    115121        die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
     
    118124    if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
    119125        wp_load_translations_early();
    120          header( 'Content-Type: text/html; charset=utf-8' );
     126
     127        $protocol = $_SERVER['SERVER_PROTOCOL'];
     128        if ( 'HTTP/1.1' !== $protocol && 'HTTP/1.0' !== $protocol ) {
     129            $protocol = 'HTTP/1.0';
     130        }
     131        header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
     132        header( 'Content-Type: text/html; charset=utf-8' );
    121133        die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
    122134    }
Note: See TracChangeset for help on using the changeset viewer.