aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_profile_fields.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_profile_fields.php')
-rw-r--r--phpBB/includes/functions_profile_fields.php24
1 files changed, 9 insertions, 15 deletions
diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php
index bb1ec476c4..9e356414a9 100644
--- a/phpBB/includes/functions_profile_fields.php
+++ b/phpBB/includes/functions_profile_fields.php
@@ -92,18 +92,6 @@ class custom_profile
{
switch ($field_type)
{
- case FIELD_INT:
- case FIELD_DROPDOWN:
- $field_value = (int) $field_value;
- break;
-
- case FIELD_BOOL:
- $field_value = (bool) $field_value;
- break;
- }
-
- switch ($field_type)
- {
case FIELD_DATE:
$field_validate = explode('-', $field_value);
@@ -133,6 +121,8 @@ class custom_profile
break;
case FIELD_BOOL:
+ $field_value = (bool) $field_value;
+
if (!$field_value && $field_data['field_required'])
{
return 'FIELD_REQUIRED';
@@ -140,10 +130,12 @@ class custom_profile
break;
case FIELD_INT:
- if (empty($field_value) && !$field_data['field_required'])
+ if (trim($field_value) === '' && !$field_data['field_required'])
{
return false;
}
+
+ $field_value = (int) $field_value;
if ($field_value < $field_data['field_minlen'])
{
@@ -156,6 +148,8 @@ class custom_profile
break;
case FIELD_DROPDOWN:
+ $field_value = (int) $field_value;
+
if ($field_value == $field_data['field_novalue'] && $field_data['field_required'])
{
return 'FIELD_REQUIRED';
@@ -514,7 +508,7 @@ class custom_profile
switch ($this->profile_types[$field_type])
{
case 'int':
- if ($value == '')
+ if ($value === '')
{
return NULL;
}
@@ -644,7 +638,7 @@ class custom_profile
}
}
- return (is_null($value)) ? '' : (int) $value;
+ return (is_null($value) || $value === '') ? '' : (int) $value;
}
else
{