Make WordPress Core

Changeset 55258


Ignore:
Timestamp:
02/07/2023 01:26:46 PM (16 months ago)
Author:
SergeyBiryukov
Message:

General: Check that set_time_limit() function is available before using it in core.

This avoids a fatal error if the function is disabled on certain environments.

Props theode, jokerrs, johnbillion, hellofromTonya, costdev, jrf, azaozz, SergeyBiryukov.
Fixes #55711.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r55210 r55258  
    35293529
    35303530    $return = array();
    3531     set_time_limit( 0 );
     3531
     3532    if ( function_exists( 'set_time_limit' ) ) {
     3533        set_time_limit( 0 );
     3534    }
    35323535
    35333536    foreach ( $_REQUEST['compare'] as $compare_key ) {
  • trunk/src/wp-admin/includes/class-wp-upgrader.php

    r55229 r55258  
    472472        $clear_destination = $args['clear_destination'];
    473473
    474         set_time_limit( 300 );
     474        if ( function_exists( 'set_time_limit' ) ) {
     475            set_time_limit( 300 );
     476        }
    475477
    476478        if ( empty( $source ) || empty( $destination ) ) {
  • trunk/src/wp-admin/includes/file.php

    r55226 r55258  
    541541
    542542        // Make sure PHP process doesn't die before loopback requests complete.
    543         set_time_limit( 5 * MINUTE_IN_SECONDS );
     543        if ( function_exists( 'set_time_limit' ) ) {
     544            set_time_limit( 5 * MINUTE_IN_SECONDS );
     545        }
    544546
    545547        // Time to wait for loopback requests to finish.
  • trunk/src/wp-admin/includes/update-core.php

    r55225 r55258  
    10541054    global $wp_filesystem, $_old_files, $_old_requests_files, $_new_bundled_files, $wpdb;
    10551055
    1056     set_time_limit( 300 );
     1056    if ( function_exists( 'set_time_limit' ) ) {
     1057        set_time_limit( 300 );
     1058    }
    10571059
    10581060    /*
  • trunk/src/wp-includes/comment.php

    r55213 r55258  
    31123112
    31133113        if ( $pingback_server_url ) {
    3114             set_time_limit( 60 );
     3114            if ( function_exists( 'set_time_limit' ) ) {
     3115                set_time_limit( 60 );
     3116            }
     3117
    31153118            // Now, the RPC call.
    31163119            $pagelinkedfrom = get_permalink( $post );
  • trunk/src/wp-includes/deprecated.php

    r55207 r55258  
    36603660    _deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' );
    36613661
    3662     @set_time_limit( 60 );
     3662    if ( function_exists( 'set_time_limit' ) ) {
     3663        @set_time_limit( 60 );
     3664    }
    36633665
    36643666    if ( $red > 5 )
Note: See TracChangeset for help on using the changeset viewer.