When I update PHP from PHP7 to PHP7.2 the website gives this error:
500 Internal Server Error
This is in the Log file:
[Thu Jan 24 04:44:56.061781 2019] [proxy_fcgi:error] [pid 30185:tid 139984342161152] [client xxxxx] AH01071: Got error 'PHP message: PHP Notice: Undefined variable: option in /home/xxxxx/domains/xxxxxxxxx.xx/public_html/templates/dj-business004/index.php on line 51\n'
Line 51 is:
if ($option && isset($sideBarsScheme[$option]) && trim($sideBarsScheme[$option]) && stristr($sideBarsScheme[$option],'content')!= false){
This is the code line 51 - 55:
if ($option && isset($sideBarsScheme[$option]) && trim($sideBarsScheme[$option]) && stristr($sideBarsScheme[$option],'content')!= false){
$currentScheme = trim($sideBarsScheme[$option]);
} else {
$currentScheme = $sideBarsScheme['default'];
}
How can I repair this?
$option
being defined? Please search for$option =
and show the code for this in your question – Lodder Jan 24 at 15:56content
is true. Also, when checking for the existence of a substring (and not actually extracting the substring), best practice dictates that you should not be callingstrstr()
orstristr()
, but ratherstrpos()
orstripos()
. This advice is specifically noted in the php manual: php.net/manual/en/function.strstr.php (see 2nd Note) – mickmackusa♦ Jan 24 at 23:24