From 34f25afe90668b962cff7df99c420d53732ce13d Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 24 Jan 2018 16:37:38 +0100 Subject: [PATCH] MySQL: Support routines with comments in parameters (bug #460) --- adminer/drivers/mysql.inc.php | 3 ++- changes.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php index 872ea938..354b08e7 100644 --- a/adminer/drivers/mysql.inc.php +++ b/adminer/drivers/mysql.inc.php @@ -813,8 +813,9 @@ if (!defined("DRIVER")) { function routine($name, $type) { global $connection, $enum_length, $inout, $types; $aliases = array("bool", "boolean", "integer", "double precision", "real", "dec", "numeric", "fixed", "national char", "national varchar"); + $space = "(?:\\s|/\\*[\s\S]*?\\*/|(?:#|-- )[^\n]*\n?|--\r?\n)"; $type_pattern = "((" . implode("|", array_merge(array_keys($types), $aliases)) . ")\\b(?:\\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"; + $pattern = "$space*(" . ($type == "FUNCTION" ? "" : $inout) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern"; $create = $connection->result("SHOW CREATE $type " . idf_escape($name), 2); preg_match("~\\(((?:$pattern\\s*,?)*)\\)\\s*" . ($type == "FUNCTION" ? "RETURNS\\s+$type_pattern\\s+" : "") . "(.*)~is", $create, $match); $fields = array(); diff --git a/changes.txt b/changes.txt index a4c80da2..2f2beb20 100644 --- a/changes.txt +++ b/changes.txt @@ -6,6 +6,7 @@ Store current Adminer version server-side to avoid excessive requests Adminer: Fix Search data in tables (regression from 4.4.0) CSP: Allow any styles, images, media and fonts, disallow base-uri MySQL: Support geometry in MySQL 8 (bug #574) +MySQL: Support routines with comments in parameters (bug #460) MariaDB: Support fulltext and spatial indexes in InnoDB (bug #583) SQLite: Enable foreign key checks PostgreSQL: Respect NULL default value