Author: toonarmy
Date: Sun Jul 19 00:20:03 2009
New Revision: 9788
Log:
Permit null values for non-required integer custom profile fields and ensure zero complies with the range limits. #40925
Modified:
branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html
branches/phpBB-3_0_0/phpBB/includes/functions_profile_fields.php
Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html
==============================================================================
*** branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html (original)
--- branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html Sun Jul 19 00:20:03 2009
***************
*** 164,169 ****
--- 164,170 ----
<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>
Modified: branches/phpBB-3_0_0/phpBB/includes/functions_profile_fields.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/includes/functions_profile_fields.php (original)
--- branches/phpBB-3_0_0/phpBB/includes/functions_profile_fields.php Sun Jul 19 00:20:03 2009
***************
*** 92,109 ****
{
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);
--- 92,97 ----
***************
*** 133,138 ****
--- 121,128 ----
break;
case FIELD_BOOL:
+ $field_value = (bool) $field_value;
+
if (!$field_value && $field_data['field_required'])
{
return 'FIELD_REQUIRED';
***************
*** 140,149 ****
break;
case FIELD_INT:
! if (empty($field_value) && !$field_data['field_required'])
{
return false;
}
if ($field_value < $field_data['field_minlen'])
{
--- 130,141 ----
break;
case FIELD_INT:
! if (trim($field_value) === '' && !$field_data['field_required'])
{
return false;
}
+
+ $field_value = (int) $field_value;
if ($field_value < $field_data['field_minlen'])
{
***************
*** 156,161 ****
--- 148,155 ----
break;
case FIELD_DROPDOWN:
+ $field_value = (int) $field_value;
+
if ($field_value == $field_data['field_novalue'] && $field_data['field_required'])
{
return 'FIELD_REQUIRED';
***************
*** 514,520 ****
switch ($this->profile_types[$field_type])
{
case 'int':
! if ($value == '')
{
return NULL;
}
--- 508,514 ----
switch ($this->profile_types[$field_type])
{
case 'int':
! if ($value === '')
{
return NULL;
}
***************
*** 644,650 ****
}
}
! return (is_null($value)) ? '' : (int) $value;
}
else
{
--- 638,644 ----
}
}
! return (is_null($value) || $value === '') ? '' : (int) $value;
}
else
{
|