Make WordPress Core


Ignore:
Timestamp:
04/04/2019 09:53:45 PM (7 years ago)
Author:
azaozz
Message:

Site health: fix usage of max_execution_time. When PHP is run from the cli the default is 0.

Fixes #46645.

File:
1 edited

Legend:

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

    r45104 r45111  
    70157015 *
    70167016 * @since MU (3.0.0)
     7017 * @since 5.2.0 $max_execution_time parameter added.
    70177018 *
    70187019 * @param string $directory Full path of a directory.
     
    70527053 * @since MU (3.0.0)
    70537054 * @since 4.3.0 $exclude parameter added.
     7055 * @since 5.2.0 $max_execution_time parameter added.
    70547056 *
    70557057 * @param string $directory Full path of a directory.
     
    70687070    }
    70697071
    7070     if ( ! $max_execution_time ) {
    7071         // Keep the previous behavior but attempt to prevent fatal errors from timeout.
     7072    if ( $max_execution_time === null ) {
     7073        // Keep the previous behavior but attempt to prevent fatal errors from timeout if possible.
    70727074        if ( function_exists( 'ini_get' ) ) {
    70737075            $max_execution_time = ini_get( 'max_execution_time' );
    70747076        } else {
    7075             // Use PHP default.
    7076             $max_execution_time = 30;
     7077            // Disable...
     7078            $max_execution_time = 0;
    70777079        }
    70787080
     
    70967098                }
    70977099
    7098                 if ( microtime( true ) - WP_START_TIMESTAMP > $max_execution_time ) {
     7100                if ( $max_execution_time > 0 && microtime( true ) - WP_START_TIMESTAMP > $max_execution_time ) {
    70997101                    // Time exceeded. Give up instead of risking a fatal timeout.
    71007102                    $size = null;
Note: See TracChangeset for help on using the changeset viewer.