From 82e4fb6cc3f4bbf81fa8057f18152fe03852f7b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 19 Oct 2004 13:55:00 +0000 Subject: [PATCH] 0 as field name causes problems (bug #1042235). --- ChangeLog | 2 ++ libraries/common.lib.php | 3 ++- tbl_create.php | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9152e178..d610032d2 100755 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ $Source$ #1048826). * main.php, queryframe.php: Handle correctly situation with no default server (bug #1049107). + * tbl_create.php, libraries/common.lib.php: 0 as field name causes + problems (bug #1042235). 2004-10-17 Marc Delisle * lang/turkish update, thanks to boralioglu. diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 1d897a0b2..fbd024849 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1352,8 +1352,9 @@ if ($is_minimum_common == FALSE) { */ function PMA_backquote($a_name, $do_it = TRUE) { + // '0' is also empty for php :-( if ($do_it - && !empty($a_name) && $a_name != '*') { + && (!empty($a_name) || $a_name == '0') && $a_name != '*') { if (is_array($a_name)) { $result = array(); diff --git a/tbl_create.php b/tbl_create.php index f71bbb43e..3e21e716e 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -55,7 +55,8 @@ if (isset($submit_num_fields)) { } // end for // Builds the fields creation statements for ($i = 0; $i < $field_cnt; $i++) { - if (empty($field_name[$i])) { + // '0' is also empty for php :-( + if (empty($field_name[$i]) && $field_name[$i] != '0') { continue; } $query = PMA_backquote($field_name[$i]) . ' ' . $field_type[$i];