]> git.joonet.de Git - adminer.git/commitdiff
Avoid each() not available in PHP 8
authorJakub Vrana <jakub@vrana.cz>
Sun, 6 Dec 2020 11:47:58 +0000 (12:47 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sun, 6 Dec 2020 11:53:28 +0000 (12:53 +0100)
adminer/include/functions.inc.php

index 4eba85c8811e135ffc62200119d36c1ad3905f4f..ea9d81b3947d0e5b4fa70f222418a25986609ea7 100644 (file)
@@ -849,19 +849,18 @@ function friendly_url($val) {
 /** Print hidden fields
 * @param array
 * @param array
+* @param string
 * @return bool
 */
-function hidden_fields($process, $ignore = array()) {
+function hidden_fields($process, $ignore = array(), $prefix = '') {
        $return = false;
-       while (list($key, $val) = each($process)) {
+       foreach ($process as $key => $val) {
                if (!in_array($key, $ignore)) {
                        if (is_array($val)) {
-                               foreach ($val as $k => $v) {
-                                       $process[$key . "[$k]"] = $v;
-                               }
+                               hidden_fields($val, array(), $key);
                        } else {
                                $return = true;
-                               echo '<input type="hidden" name="' . h($key) . '" value="' . h($val) . '">';
+                               echo '<input type="hidden" name="' . h($prefix ? $prefix . "[$key]" : $key) . '" value="' . h($val) . '">';
                        }
                }
        }