aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/tools.php
diff options
context:
space:
mode:
authorPatrick Webster <noxwizard@phpbb.com>2014-06-15 14:52:05 -0500
committerPatrick Webster <noxwizard@phpbb.com>2014-06-15 19:07:32 -0500
commit754e36e378e9d5d744fcfd6d447bd1e48d2052c3 (patch)
tree297de5bfd2d0b2fbf2a21ab5bf81864b928c8a4f /phpBB/phpbb/db/tools.php
parente6a8df7f7ea2036ae9943368ad1ea2cee7cd5655 (diff)
downloadforums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.tar
forums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.tar.gz
forums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.tar.bz2
forums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.tar.xz
forums-754e36e378e9d5d744fcfd6d447bd1e48d2052c3.zip
[ticket/12643] Properly handle changing columns on tables with constraints
PHPBB3-12643
Diffstat (limited to 'phpBB/phpbb/db/tools.php')
-rw-r--r--phpBB/phpbb/db/tools.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index 3b329b47bc..2ee842eace 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -2561,7 +2561,18 @@ class tools
foreach ($old_table_cols as $key => $declaration)
{
- $entities = preg_split('#\s+#', trim($declaration));
+ $declaration = trim($declaration);
+
+ // Check for the beginning of the constraint section and stop
+ if (preg_match('/[^\(]*\s*PRIMARY KEY\s+\(/', $declaration) ||
+ preg_match('/[^\(]*\s*UNIQUE\s+\(/', $declaration) ||
+ preg_match('/[^\(]*\s*FOREIGN KEY\s+\(/', $declaration) ||
+ preg_match('/[^\(]*\s*CHECK\s+\(/', $declaration))
+ {
+ break;
+ }
+
+ $entities = preg_split('#\s+#', $declaration);
$column_list[] = $entities[0];
if ($entities[0] == $column_name)
{