mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/9075] CPF Numbers fields: Prevent SQL error on registration page.
When an administrator set a numbers field to default to 'not specified', a SQL error was caused on the registration page because it was tried to insert an empty string into an integer column. Because the column already supports NULL values, empty strings are now converted to NULL for custom profile fields of the type 'Numbers' before insertion into the data table. PHPBB3-9075
This commit is contained in:
parent
6ff403c9f8
commit
ec3dac0595
1 changed files with 5 additions and 0 deletions
|
@ -878,6 +878,11 @@ class custom_profile
|
|||
$now = getdate();
|
||||
$row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']);
|
||||
}
|
||||
else if ($row['field_default_value'] === '' && $row['field_type'] == FIELD_INT)
|
||||
{
|
||||
// We cannot insert an empty string into an integer column.
|
||||
$row['field_default_value'] = NULL;
|
||||
}
|
||||
|
||||
$cp_data['pf_' . $row['field_ident']] = (in_array($row['field_type'], array(FIELD_TEXT, FIELD_STRING))) ? $row['lang_default_value'] : $row['field_default_value'];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue