Skip to content
Browse files

Respect function results in where()

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@441 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 9ea3112 commit 581bd3504549c88fbb692aa509972013a9190de2 jakubvrana committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 functions.inc.php
View
6 functions.inc.php
@@ -141,10 +141,12 @@ function where($where) {
global $mysql;
$return = array();
foreach ((array) $where["where"] as $key => $val) {
- $return[] = idf_escape(bracket_escape($key, "back")) . " = BINARY '" . $mysql->escape_string($val) . "'"; //! enum and set
+ $key = bracket_escape($key, "back");
+ $return[] = (preg_match('~^[A-Z0-9_]+\\(`(?:[^`]+|``)+`\\)$~', $key) ? $key : idf_escape($key)) . " = BINARY '" . $mysql->escape_string($val) . "'"; //! enum and set, columns looking like functions
}
foreach ((array) $where["null"] as $key) {
- $return[] = idf_escape(bracket_escape($key, "back")) . " IS NULL";
+ $key = bracket_escape($key, "back");
+ $return[] = (preg_match('~^[A-Z0-9_]+\\(`(?:[^`]+|``)+`\\)$~', $key) ? $key : idf_escape($key)) . " IS NULL";
}
return $return;
}

0 comments on commit 581bd35

Please sign in to comment.
Something went wrong with that request. Please try again.