[wp-trac] [WordPress Trac] #55711: set_time_limit( 300 ); in Class WP_Upgrader causes crashes in PHP8 when hosting disables it

WordPress Trac noreply at wordpress.org
Thu May 12 20:35:29 UTC 2022


#55711: set_time_limit( 300 ); in Class WP_Upgrader causes crashes in PHP8 when
hosting disables it
-----------------------------+------------------------------
 Reporter:  theode           |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Upgrade/Install  |     Version:  5.9.3
 Severity:  critical         |  Resolution:
 Keywords:  php8             |     Focuses:  administration
-----------------------------+------------------------------
Changes (by costdev):

 * keywords:   => php8


Comment:

 > @hellofromTonya function_exists( 'set_time_limit' ) would guard against
 invoking the native PHP function when it's been disabled and is not in
 memory.

 To clarify this:
 - `function_exists()` will return `false` for a native function that is
 not in memory or in the PHP binary. However, it will return `true` for a
 native function disabled via the `disable_functions` directive. (I know!)
 - There are three ways I'm aware of to return `true` for a native function
 disabled via `disabled_functions`:
     1. `false === strpos()` as WooCommerce and SMTP use.
     2. `! str_contains()` - a modern version of the above.
     3. `is_callable()` - Which feels more accurate in context. Check if it
 exists with `function_exists()`, check if it's callable with
 `is_callable()`.

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


More information about the wp-trac mailing list