After updating to PHP8, my site has started crashing with the error
PHP message: PHP Fatal error: Uncaught ArgumentCountError: parse_str() expects exactly 2 arguments, 1 given
I believe it some change in the php 8 syntax, but I am not sure. I used to use php 7.4
The problematic line is:
$url_vars = parse_str($parse_url['query'] ?? 0);
The section of the problematic script is below:
if ( $referrer !== FALSE && $referrer !== '' && stripos($referrer, '://') )
{
$parse_url = parse_url($referrer);
$domain = $parse_url['host'];
$query = $parse_url['query'] ?? 0;
$dotdomain = '.'.$domain;
if ( strlen($parse_url['query'] ?? 0) >= 1 )
{
$url_vars = parse_str($parse_url['query'] ?? 0);
if (FALSE === empty($url_vars['q']))
{
$utm_keyword = $url_vars['q'] ?? 0;
}
}
Can someone more familiar with php 8 see any obvious error on the code above?