[wp-trac] [WordPress Trac] #56010: apache_mod_loaded returns fatal TypeError in some environments with PHP 8

WordPress Trac noreply at wordpress.org
Mon Jun 20 15:26:01 UTC 2022


#56010: apache_mod_loaded returns fatal TypeError in some environments with PHP 8
----------------------------+---------------------
 Reporter:  engahmeds3ed    |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  6.1
Component:  General         |     Version:
 Severity:  major           |  Resolution:
 Keywords:  php8 has-patch  |     Focuses:
----------------------------+---------------------
Changes (by SergeyBiryukov):

 * keywords:  php8 => php8 has-patch
 * milestone:  Awaiting Review => 6.1


Comment:

 Hi there, welcome to WordPress Trac! Thanks for the report.

 I think ensuring that `$mods` is an array might make sense in theory.
 However, an array is the documented return value for
 `apache_get_modules()`. Unless I'm missing something, the only way to get
 that fatal error is to redeclare the disabled function (which is possible
 in PHP 8.0+) and return `null` instead of an array, which seems like a
 wrong thing to do on the host's part, an empty array should be returned
 instead.

 If the function is simply disabled and not redeclared, the
 `function_exists()` check should return `false`, though that may not
 always be the case, see comment:10:ticket:55711.

 Based on comment:2, it looks like this was corrected and the host made
 adjustments to return an empty array. In that case, I think we can use the
 existing `phpinfo()` fallback, see [attachment:56010.diff].

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


More information about the wp-trac mailing list