]> git.joonet.de Git - adminer.git/commitdiff
Don't highlight NULL as JSON
authorJakub Vrana <jakub@vrana.cz>
Thu, 13 Mar 2025 15:55:17 +0000 (16:55 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 13 Mar 2025 15:55:17 +0000 (16:55 +0100)
adminer/include/adminer.inc.php

index b320d4ec883753d5f4ab025d250f92c77f1bbf96..02e634c1722e60d9bd6bc6ff57a0068869458d2a 100644 (file)
@@ -289,13 +289,14 @@ class Adminer {
        * @return string
        */
        function selectVal($val, $link, $field, $original) {
-               $return = ($val === null ? "<i>NULL</i>" : (preg_match("~char|binary|boolean~", $field["type"]) && !preg_match("~var~", $field["type"]) ? "<code>$val</code>" : $val));
+               $return = ($val === null ? "<i>NULL</i>"
+                       : (preg_match("~char|binary|boolean~", $field["type"]) && !preg_match("~var~", $field["type"]) ? "<code>$val</code>"
+                       : (preg_match('~json~', $field["type"]) ? "<code class='jush-js'>$val</code>"
+                       : $val)
+               ));
                if (preg_match('~blob|bytea|raw|file~', $field["type"]) && !is_utf8($val)) {
                        $return = "<i>" . lang('%d byte(s)', strlen($original)) . "</i>";
                }
-               if (preg_match('~json~', $field["type"])) {
-                       $return = "<code class='jush-js'>$return</code>";
-               }
                return ($link ? "<a href='" . h($link) . "'" . (is_url($link) ? target_blank() : "") . ">$return</a>" : $return);
        }