[wp-trac] [WordPress Trac] #58778: global _SERVER accessed in load.php without a global statement

WordPress Trac noreply at wordpress.org
Tue Jul 11 02:31:48 UTC 2023


#58778: global _SERVER accessed in load.php without a global statement
--------------------------+-----------------------------
 Reporter:  xswarren      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.2.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 wp-includes/load.php function wp_fix_server_vars() reads and writes global
 variable $_SERVER but does not contain statement "global $_SERVER;". This
 seems wrong since PHP requires global variables to be explicitly declared
 as such IIUC.

 This morning, my web server error log started to contain the error line
 shown below, and the HTML sent by the server started using http:// URLs
 instead of https:// URLs for some assets (Elementor CSS & JS files), which
 prevented my site from working:

 [10-Jul-2023 17:12:38 UTC] PHP Warning: array_merge(): Expected parameter
 2 to be an array, null given in
 /home/customer/www/fortcollinscreatorhub.org/public_html/wp-
 includes/load.php on line 40

 Editing that function to add "global $_SERVER;" solved both the URLs and
 the error messages... That said, this code has been this way for ages, so
 I have no idea why I suddenty needed to edit that file when allegedly my
 hosting provider has not changes anything according to their help
 ticket...

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58778>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list