Skip to content

Commit b826d0d

Browse files
committed
Fix issues with QI using removed each() from PHP 8
Signed-off-by: Matt Friedman <[email protected]>
1 parent caac279 commit b826d0d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

includes/qi_functions.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,20 @@ function legacy_request_var($var_name, $default, $multibyte = false, $cookie = f
278278
}
279279
else
280280
{
281-
list($key_type, $type) = each($default);
281+
// Get first key and value
282+
$key_type = key($default);
283+
$type = current($default);
282284
$type = gettype($type);
283285
$key_type = gettype($key_type);
286+
284287
if ($type === 'array')
285288
{
286289
reset($default);
287290
$default = current($default);
288-
list($sub_key_type, $sub_type) = each($default);
291+
292+
// Get first key and value of the nested array
293+
$sub_key_type = key($default);
294+
$sub_type = current($default);
289295
$sub_type = gettype($sub_type);
290296
$sub_type = ($sub_type === 'array') ? 'NULL' : $sub_type;
291297
$sub_key_type = gettype($sub_key_type);

0 commit comments

Comments
 (0)