Our host recently enforced us to upgrade to php 8.0 from 7.4
We are getting this error:
>>PHP Warning: Undefined array key.
It is a pure PHP e-commerce site originally built on the Dwoo template engine.
Can the code be modifed to work with php 8.0? And what needs to change? Below is the code:
while (list($k, $sep) = each($m[1])) {
if ($sep === '.' || $sep === '[' || $sep === '') {
if ((is_array($cur) || $cur instanceof ArrayAccess) && isset($cur[$m[2][$k]])) {
$cur = $cur[$m[2][$k]];
} else {
return null;
}
} elseif ($sep === '->') {
if (is_object($cur)) {
$cur = $cur->$m[2][$k];
} else {
return null;
}
} else {
return null;
}
}
return $cur;
}
I tried to remove the EACH function to this:
while (list($k, $sep) = $m\[1\]) {
But still receiving errors and certain things not working.