mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Permit null values for non-required integer custom profile fields and ensure zero complies with the range limits. #40925
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9788 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
08a7255c8e
commit
4f6f9c424d
2 changed files with 10 additions and 15 deletions
|
@ -164,6 +164,7 @@
|
||||||
<li>[Fix] Remove redundant SQL query from ucp.php. (Bug #40305)</li>
|
<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] 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] 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] 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] 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>
|
<li>[Change] Template engine now permits to a limited extent variable includes.</li>
|
||||||
|
|
|
@ -90,18 +90,6 @@ class custom_profile
|
||||||
*/
|
*/
|
||||||
function validate_profile_field($field_type, &$field_value, $field_data)
|
function validate_profile_field($field_type, &$field_value, $field_data)
|
||||||
{
|
{
|
||||||
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)
|
switch ($field_type)
|
||||||
{
|
{
|
||||||
case FIELD_DATE:
|
case FIELD_DATE:
|
||||||
|
@ -133,6 +121,8 @@ class custom_profile
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FIELD_BOOL:
|
case FIELD_BOOL:
|
||||||
|
$field_value = (bool) $field_value;
|
||||||
|
|
||||||
if (!$field_value && $field_data['field_required'])
|
if (!$field_value && $field_data['field_required'])
|
||||||
{
|
{
|
||||||
return 'FIELD_REQUIRED';
|
return 'FIELD_REQUIRED';
|
||||||
|
@ -140,10 +130,12 @@ class custom_profile
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FIELD_INT:
|
case FIELD_INT:
|
||||||
if (empty($field_value) && !$field_data['field_required'])
|
if (trim($field_value) === '' && !$field_data['field_required'])
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$field_value = (int) $field_value;
|
||||||
|
|
||||||
if ($field_value < $field_data['field_minlen'])
|
if ($field_value < $field_data['field_minlen'])
|
||||||
{
|
{
|
||||||
|
@ -156,6 +148,8 @@ class custom_profile
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FIELD_DROPDOWN:
|
case FIELD_DROPDOWN:
|
||||||
|
$field_value = (int) $field_value;
|
||||||
|
|
||||||
if ($field_value == $field_data['field_novalue'] && $field_data['field_required'])
|
if ($field_value == $field_data['field_novalue'] && $field_data['field_required'])
|
||||||
{
|
{
|
||||||
return 'FIELD_REQUIRED';
|
return 'FIELD_REQUIRED';
|
||||||
|
@ -514,7 +508,7 @@ class custom_profile
|
||||||
switch ($this->profile_types[$field_type])
|
switch ($this->profile_types[$field_type])
|
||||||
{
|
{
|
||||||
case 'int':
|
case 'int':
|
||||||
if ($value == '')
|
if ($value === '')
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -644,7 +638,7 @@ class custom_profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (is_null($value)) ? '' : (int) $value;
|
return (is_null($value) || $value === '') ? '' : (int) $value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue