aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislav Atanasov <lucifer@anavaro.com>2014-07-13 01:45:20 +0300
committerStanislav Atanasov <lucifer@anavaro.com>2014-07-13 01:45:20 +0300
commit1043d1a27cdb2f7bfd92501a240bd69387b36d69 (patch)
treeda397548b597ac9336fa9abb484bb51c528f8b35
parent0d6fe203729cdade106e21383c3faa5f71b378ce (diff)
downloadforums-1043d1a27cdb2f7bfd92501a240bd69387b36d69.tar
forums-1043d1a27cdb2f7bfd92501a240bd69387b36d69.tar.gz
forums-1043d1a27cdb2f7bfd92501a240bd69387b36d69.tar.bz2
forums-1043d1a27cdb2f7bfd92501a240bd69387b36d69.tar.xz
forums-1043d1a27cdb2f7bfd92501a240bd69387b36d69.zip
[ticket/12846] SQLite3 bug in profilefield_base_migration.php
Using profilefield_base_migration.php to create a custom profile field with SQlite3 DBMS returns warning: [phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/sqlite3.php on line 218: SQLite3Result::fetchArray(): Unable to execute statement: constraint failed This is due passing filed_id and lang_id to the DB driver in unspecified format. As they are always int we should cast them in int to prevent the error message appearance. PHPBB3-12846
-rw-r--r--phpBB/phpbb/db/migration/profilefield_base_migration.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php
index e66e5fd080..9000949a7d 100644
--- a/phpBB/phpbb/db/migration/profilefield_base_migration.php
+++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php
@@ -107,8 +107,8 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
while ($lang_id = (int) $this->db->sql_fetchfield('lang_id'))
{
$insert_buffer->insert(array(
- 'field_id' => $field_id,
- 'lang_id' => $lang_id,
+ 'field_id' => (int) $field_id,
+ 'lang_id' => (int) $lang_id,
'lang_name' => $lang_name,
'lang_explain' => '',
'lang_default_value' => '',
@@ -136,8 +136,8 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
foreach ($this->profilefield_language_data as $language_data)
{
$insert_buffer->insert(array_merge(array(
- 'field_id' => $field_id,
- 'lang_id' => $lang_id,
+ 'field_id' => (int) $field_id,
+ 'lang_id' => (int) $lang_id,
), $language_data));
}
}
@@ -154,15 +154,15 @@ abstract class profilefield_base_migration extends \phpbb\db\migration\migration
$field_id = $this->get_custom_profile_field_id();
$sql = 'DELETE FROM ' . PROFILE_FIELDS_TABLE . '
- WHERE field_id = ' . $field_id;
+ WHERE field_id = ' . (int) $field_id;
$this->db->sql_query($sql);
$sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . '
- WHERE field_id = ' . $field_id;
+ WHERE field_id = ' . (int) $field_id;
$this->db->sql_query($sql);
$sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . '
- WHERE field_id = ' . $field_id;
+ WHERE field_id = ' . (int) $field_id;
$this->db->sql_query($sql);
}