Make WordPress Core


Ignore:
Timestamp:
08/16/2024 02:27:03 PM (2 months ago)
Author:
SergeyBiryukov
Message:

Script Loader: Check if error_reporting() exists in load-(scripts|styles).php.

This avoids a fatal error on PHP 8 if error_reporting() is disabled in php.ini.

On systems with this function disabled, it's best to add a dummy function to the wp-config.php file, as there are multiple other calls in core or plugins.

However, as this call to the function is run prior to wp-config.php loading, it is now wrapped in a function_exists() check.

Follow-up to [50447].

Props gansbrest, sabernhardt, jrf, martin.krcho, SergeyBiryukov.
Fixes #61873.

File:
1 edited

Legend:

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

    r57943 r58905  
    22
    33/*
    4  * Disable error reporting.
    5  *
    6  * Set this to error_reporting( -1 ) for debugging.
     4 * The error_reporting() function can be disabled in php.ini. On systems where that is the case,
     5 * it's best to add a dummy function to the wp-config.php file, but as this call to the function
     6 * is run prior to wp-config.php loading, it is wrapped in a function_exists() check.
    77 */
    8 error_reporting( 0 );
     8if ( function_exists( 'error_reporting' ) ) {
     9    /*
     10     * Disable error reporting.
     11     *
     12     * Set this to error_reporting( -1 ) for debugging.
     13     */
     14    error_reporting( 0 );
     15}
    916
    1017// Set ABSPATH for execution.
Note: See TracChangeset for help on using the changeset viewer.