aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/db_tools.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-06-12 04:10:51 +0200
committerNils Adermann <naderman@naderman.de>2011-06-12 04:10:51 +0200
commitef544ee095f2decde39cc537d3d675642b7c80f2 (patch)
tree0ed36025f517c5e8254203a8faccf519b31d9932 /phpBB/includes/db/db_tools.php
parent8a5e3781d53e3df379c55166136abd6e71990af4 (diff)
downloadforums-ef544ee095f2decde39cc537d3d675642b7c80f2.tar
forums-ef544ee095f2decde39cc537d3d675642b7c80f2.tar.gz
forums-ef544ee095f2decde39cc537d3d675642b7c80f2.tar.bz2
forums-ef544ee095f2decde39cc537d3d675642b7c80f2.tar.xz
forums-ef544ee095f2decde39cc537d3d675642b7c80f2.zip
[ticket/9892] Table prefix lengths influence index lengths in db_tools
PHPBB3-9892
Diffstat (limited to 'phpBB/includes/db/db_tools.php')
-rw-r--r--phpBB/includes/db/db_tools.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php
index 0e3173c23e..c1af2782f8 100644
--- a/phpBB/includes/db/db_tools.php
+++ b/phpBB/includes/db/db_tools.php
@@ -419,7 +419,7 @@ class phpbb_db_tools
if (isset($prepared_column['auto_increment']) && strlen($column_name) > 26) // "${column_name}_gen"
{
- trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
+ trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR);
}
// here we add the definition of the new column to the list of columns
@@ -2056,9 +2056,11 @@ class phpbb_db_tools
{
$statements = array();
- if (strlen($table_name . $index_name) > 30)
+ $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
+ if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
{
- trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
+ $max_length = $table_prefix + 24;
+ trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
}
switch ($this->sql_layer)
@@ -2091,9 +2093,11 @@ class phpbb_db_tools
{
$statements = array();
- if (strlen($table_name . $index_name) > 30)
+ $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
+ if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
{
- trigger_error("Index name '${table_name}_$index_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR);
+ $max_length = $table_prefix + 24;
+ trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
}
// remove index length unless MySQL4