aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-07-27 20:11:44 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-07-27 20:11:44 +0200
commit3df41920f7fa0291aa2b093ce3c6d036e103f9db (patch)
treea49cd8aa8a90a86c2534ca5f54a7799339cc0ffe
parent8a6d3f2b1d306d7dcc7480899bb30737b7cb4092 (diff)
parent902937ce70ae1c992a120679fc7b0a0134c5451d (diff)
downloadforums-3df41920f7fa0291aa2b093ce3c6d036e103f9db.tar
forums-3df41920f7fa0291aa2b093ce3c6d036e103f9db.tar.gz
forums-3df41920f7fa0291aa2b093ce3c6d036e103f9db.tar.bz2
forums-3df41920f7fa0291aa2b093ce3c6d036e103f9db.tar.xz
forums-3df41920f7fa0291aa2b093ce3c6d036e103f9db.zip
Merge pull request #2718 from lucifer4o/ticket/12793
[ticket/12793] String '0' does not display for string profile fields * lucifer4o/ticket/12793: [ticket/12793] Tests (added and changed) [ticket/12793] Changing get_profile_contact_value to get_profile_value_raw [ticket/12793] String '0' does not display for string profile fields
-rw-r--r--phpBB/phpbb/profilefields/type/type_string_common.php11
-rw-r--r--tests/profilefields/type_string_test.php10
2 files changed, 11 insertions, 10 deletions
diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php
index c2b951b6c9..0eaf7e527d 100644
--- a/phpBB/phpbb/profilefields/type/type_string_common.php
+++ b/phpBB/phpbb/profilefields/type/type_string_common.php
@@ -98,7 +98,7 @@ abstract class type_string_common extends type_base
*/
public function get_profile_value($field_value, $field_data)
{
- if (!$field_value && !$field_data['field_show_novalue'])
+ if (($field_value === null || $field_value === '') && !$field_data['field_show_novalue'])
{
return null;
}
@@ -114,7 +114,7 @@ abstract class type_string_common extends type_base
*/
public function get_profile_value_raw($field_value, $field_data)
{
- if (!$field_value && !$field_data['field_show_novalue'])
+ if (($field_value === null || $field_value === '') && !$field_data['field_show_novalue'])
{
return null;
}
@@ -127,12 +127,7 @@ abstract class type_string_common extends type_base
*/
public function get_profile_contact_value($field_value, $field_data)
{
- if (!$field_value && !$field_data['field_show_novalue'])
- {
- return null;
- }
-
- return $field_value;
+ return $this->get_profile_value_raw($field_value, $field_data);
}
/**
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index f6c14ee38b..2277526758 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -249,8 +249,14 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
array(
0,
array('field_show_novalue' => false),
- null,
- 'Field should return null for empty integer without show_novalue',
+ 0,
+ 'Field should return value of integer 0 without show_novalue',
+ ),
+ array(
+ '0',
+ array('field_show_novalue' => false),
+ '0',
+ 'Field should return string 0',
),
array(
0,