From: jakubvrana Date: Wed, 16 Sep 2009 21:47:23 +0000 (+0000) Subject: Change regular expression (bug #2859386) X-Git-Tag: v3.0.0~423 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=79c70ad5fb0a44419338e8b4baea775cfc30ba23;p=adminer.git Change regular expression (bug #2859386) git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1111 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- diff --git a/adminer/include/editing.inc.php b/adminer/include/editing.inc.php index 907847f4..56f08e44 100644 --- a/adminer/include/editing.inc.php +++ b/adminer/include/editing.inc.php @@ -231,9 +231,9 @@ function normalize_enum($match) { } function routine($name, $type) { - global $dbh, $enum_length, $inout; + global $dbh, $enum_length, $inout, $types; $aliases = array("bit" => "tinyint", "bool" => "tinyint", "boolean" => "tinyint", "integer" => "int", "double precision" => "float", "real" => "float", "dec" => "decimal", "numeric" => "decimal", "fixed" => "decimal", "national char" => "char", "national varchar" => "varchar"); - $type_pattern = "([a-z]+)(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?"; + $type_pattern = "(" . implode("|", array_keys($types + $aliases)) . ")(?:\\s*\\(((?:[^'\")]*|$enum_length)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?"; $pattern = "\\s*(" . ($type == "FUNCTION" ? "" : implode("|", $inout)) . ")?\\s*(?:`((?:[^`]|``)*)`\\s*|\\b(\\S+)\\s+)$type_pattern"; $create = $dbh->result($dbh->query("SHOW CREATE $type " . idf_escape($name)), 2); preg_match("~\\(((?:$pattern\\s*,?)*)\\)" . ($type == "FUNCTION" ? "\\s*RETURNS\\s+$type_pattern" : "") . "\\s*(.*)~is", $create, $match);