'PHP 7.4 to 8.0 - Errors (Trying to access array offset)
We just updated to PHP 8.0 from 7.4 and are getting a bunch of errors that I'm working through.
One of the errors is actually 2 errors that looks like this:
Warning: Undefined variable $HTTP_SERVER_VARS in /home/mxst1k/public_html/includes/functions.inc.php on line 123
Warning: Trying to access array offset on value of type null in /home/mxst1k/public_html/includes/functions.inc.php on line 123
In this case, line 123 is the second row in the snippet of code below:
if (!isset($HTTP_SERVER_VARS['REQUEST_URI'])) {
$HTTP_SERVER_VARS['REQUEST_URI'] = $HTTP_SERVER_VARS["PHP_SELF"];
if (isset($HTTP_SERVER_VARS['QUERY_STRING']) && $HTTP_SERVER_VARS['QUERY_STRING']!='') {
$HTTP_SERVER_VARS['REQUEST_URI'] .= '?' . $HTTP_SERVER_VARS['QUERY_STRING'];
}
}
I've been trial and error fixing some of the other warnings and errors, but this is from a functions include file and I don't want to mess it up! I believe I may need to do something with Isset here, but it's a little fuzzy for me.
Any insight on the fix here would be greatly appreciated.
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
