[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 02:25:15 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 gansbrest):

 @SergeyBiryukov just wanted to clarify couple things.

 I do use dummy function in wp-config.php, the problem still remains on
 admin pages (you can test it yourself by disabling error_reporting in the
 ini and navigating to /wp-admin pages).

 Here is the example of direct call from wp-admin area:


 {{{
 GET /wp-admin/load-styles.php?c=1&dir=ltr&load%5Bchunk_0%5D=dashicons
 ,admin-bar,common,forms,admin-menu,dashboard,list-
 tables,edit,revisions,media,themes,about,nav-menus,wp-
 pointer,widgets&load%5Bchunk_1%5D=,site-icon,l10n,buttons,wp-auth-check
 ,wp-color-picker&ver=6.5.4
 }}}

 As you can see it calls `/wp-admin/load-styles.php` directly (similar to
 `load-scripts.php` calls).

 If we look inside of the `load-styles/scripts.php`  files (see my
 [https://github.com/WordPress/wordpress-develop/pull/7197 pull request]
 above) we can notice that error_reporting is called before `wp-config.php`
 is initialized (hence the need for the PR).

 It just throws fatal errors for each style or script.

 I had to patch my WP installations with the additional `function_exists`
 checks I submitted in the PR here to get rid of fatal errors and restore
 functionality on PHP 8 setups ( with dummy function in wp-config.php of
 course ).

 p.s. I did go through all of the remaining error_reporting calls in core
 and none of them seems to be breaking **running websites** with dummy
 error_reporting definition in the wp-config.php.

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


More information about the wp-trac mailing list