[wp-trac] [WordPress Trac] #58380: Setting time limit for updates doesn't always work.

WordPress Trac noreply at wordpress.org
Thu Jun 22 10:02:35 UTC 2023


#58380: Setting time limit for updates doesn't always work.
----------------------------------------+-----------------------
 Reporter:  NekoJonez                   |       Owner:  pbiron
     Type:  enhancement                 |      Status:  accepted
 Priority:  normal                      |   Milestone:  6.3
Component:  Upgrade/Install             |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-dev-note 2nd-opinion  |     Focuses:
----------------------------------------+-----------------------
Changes (by costdev):

 * keywords:  needs-dev-note => needs-dev-note 2nd-opinion


Comment:

 Thanks!

 I also modified the code above to check for `SUHOSIN` and `ini_get(
 'disable_functions' )` and sent it. @NekoJonez got the following results:

 > SUHOSIN is not loaded. `set_time_limit()` is not disabled.

 So the wrapping of the `set_time_limit()` call in question with `if (
 function_exists( 'set_time_limit' ) )` as done by [55258] won't solve the
 issue as this returns `true` in this case, and that's confirmed by
 checking the `disable_functions` PHP directive which doesn't bear fruit
 either.

 The only two paths forward I can see at the moment are:
 - We suppress the warnings of all `set_time_limit()` calls in Core with
 `@`, possibly wrapping in an `if ( WP_DEBUG )` which if `true`, doesn't
 suppress the warnings.
   - However, this goes against a Core effort to reduce/remove the use of
 the `@` operator (#24780).
   - That said:
     - #49014 is a very closely related ticket in which the host added
 `set_time_limit()` to the `disable_functions` directive and the requested
 solution is to use `@` or `error_reporting( 0 )`.
     - `set_time_limit()` warnings are suppressed in
 [https://github.com/wordpress/wordpress-
 develop/blob/1dc58551624769079e446549cb4000b9cad13a90/src/wp-
 includes/deprecated.php#L3659 wp_get_http()], albeit a deprecated
 function, so precedent in Core is debatable.
 - We issue an update to WordPress Core requirements that the PHP native
 `set_time_limit()` function must either be available, or be disabled by
 the `disable_functions` directive so we can detect this with
 `function_exists()`.

 Neither of these are ideal paths forward, but I'd veer on using `@` for
 `set_time_limit()` throughout Core until such time as an alternative is
 found.

 I'm adding `2nd-opinion` to gather more thoughts, and pinging
 @SergeyBiryukov and @audrasjb for their views. If the first of the two
 paths mentioned above is selected, we can definitely patch this for 6.3.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58380#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list