[wp-trac] [WordPress Trac] #61873: Check if error_reporting function exists, otherwise breaks php8 installs when disabled in the ini config

WordPress Trac noreply at wordpress.org
Thu Aug 15 00:57:36 UTC 2024


#61873: Check if error_reporting function exists, otherwise breaks php8 installs
when disabled in the ini config
--------------------------+------------------------------------------------
 Reporter:  gansbrest     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:                |     Version:  trunk
  Administration          |
 Severity:  major         |  Resolution:
 Keywords:  has-patch     |     Focuses:  administration, php-compatibility
--------------------------+------------------------------------------------

Comment (by SergeyBiryukov):

 Hi there, thanks for the ticket!

 Replying to [ticket:61873 gansbrest]:
 > Short summary of the problem: When `error_reporting` function is
 disabled on the hosting provider, it breaks admin area due to the fact
 that `wp-admin/load-styles.php` and `wp-admin/load-scripts.php` are
 triggering it without checking.
 >
 > Some work has been done to resolve the problem on #52226
 >
 > Unfortunately it doesn't address the issue completely as it only adds
 checks to the `wp-load.php` file.

 As noted in the commit message for [50447]:
 > 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.

 There are quite a few other `error_reporting()` calls in core, a quick
 search shows 21 matches in 11  files. However, defining an empty function
 in `wp-config.php` should resolve the issue without changing all those
 instances:
 {{{
 function error_reporting() {}
 }}}

 A`function_exists()` check was only added to `wp-load.php` is because it
 runs before `wp-config.php` is loaded.

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


More information about the wp-trac mailing list