diff options
| -rw-r--r-- | phpBB/docs/CHANGELOG.html | 1 | ||||
| -rw-r--r-- | phpBB/includes/functions_profile_fields.php | 24 |
2 files changed, 10 insertions, 15 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8f667faef2..40e938546c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -164,6 +164,7 @@ <li>[Fix] Remove redundant SQL query from ucp.php. (Bug #40305)</li> <li>[Fix] Reorder frame order of animated subsilver2 topic icons to be useful when animation is disabled. (Bug #29385 - Patch by prototech)</li> <li>[Fix] Ensure user errors are displayed regardless of PHP settings. (Bug #47505)</li> + <li>[Fix] Permit null values for non-required integer custom profile fields and ensure zero complies with the range limits. (Bug #40925)</li> <li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li> <li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li> <li>[Change] Template engine now permits to a limited extent variable includes.</li> 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 { |
