From: Jakub Vrana Date: Mon, 14 May 2012 00:19:53 +0000 (-0700) Subject: Fix parsing of functions returning datetime (bug #3518425) X-Git-Tag: v3.4.0~38 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=4f3fddc870b3bb5105b4e15e138f0a175bb9a55b;p=adminer.git Fix parsing of functions returning datetime (bug #3518425) --- diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index 681a4e13..6274c997 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -752,7 +752,7 @@ if (!defined("DRIVER")) { $type_pattern = "((" . implode("|", array_merge(array_keys($types), $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?)(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?"; $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : $inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern"; $create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2); - preg_match("~\\(((?:$pattern\\s*,?)*)\\)" . ($type == "FUNCTION" ? "\\s*RETURNS\\s+$type_pattern" : "") . "\\s*(.*)~is", $create, $match); + preg_match("~\\(((?:$pattern\\s*,?)*)\\)\\s*" . ($type == "FUNCTION" ? "RETURNS\\s+$type_pattern\\s+" : "") . "(.*)~is", $create, $match); $fields = array(); preg_match_all("~$pattern\\s*,?~is", $match[1], $matches, PREG_SET_ORDER); foreach ($matches as $param) {