aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/tools.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-04-28 21:47:55 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-05-02 15:45:21 +0200
commit07042e484e34115a89985fcd7841c75b1b6135a9 (patch)
treef8bf8b8efc3dd357da3860b3f25590ef91959215 /phpBB/phpbb/db/tools.php
parent8c2b80e3d25c716ae9c81fe833cc4bb62eb03279 (diff)
downloadforums-07042e484e34115a89985fcd7841c75b1b6135a9.tar
forums-07042e484e34115a89985fcd7841c75b1b6135a9.tar.gz
forums-07042e484e34115a89985fcd7841c75b1b6135a9.tar.bz2
forums-07042e484e34115a89985fcd7841c75b1b6135a9.tar.xz
forums-07042e484e34115a89985fcd7841c75b1b6135a9.zip
[feature/sqlite3] Remove trailing comma from column list
PHPBB3-9728
Diffstat (limited to 'phpBB/phpbb/db/tools.php')
-rw-r--r--phpBB/phpbb/db/tools.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index ddd1ca5957..a462b2fdc7 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -2006,7 +2006,12 @@ class tools
$columns = implode(',', $column_list);
- $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols);
+ $new_table_cols = trim(preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols));
+ if (substr($new_table_cols, -1) === ',')
+ {
+ // Remove the comma from the last entry again
+ $new_table_cols = substr($new_table_cols, 0, -1);
+ }
// create a new table and fill it up. destroy the temp one
$statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');';