From ffbc7ccb64f28c0932f4ec09a94379e968224945 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 25 Feb 2014 18:24:45 +0100 Subject: [PATCH] [ticket/12205] Do not display 0 for empty integers when show_novalue is off PHPBB3-12205 --- phpBB/includes/functions_profile_fields.php | 2 +- tests/profile/get_profile_value_test.php | 42 +++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/profile/get_profile_value_test.php diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 8573533c2c..a2c0656ca4 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -532,7 +532,7 @@ class custom_profile switch ($this->profile_types[$field_type]) { case 'int': - if ($value === '' && !$ident_ary['data']['field_show_novalue']) + if (($value === '' || $value === null) && !$ident_ary['data']['field_show_novalue']) { return NULL; } diff --git a/tests/profile/get_profile_value_test.php b/tests/profile/get_profile_value_test.php new file mode 100644 index 0000000000..a5f37a85ce --- /dev/null +++ b/tests/profile/get_profile_value_test.php @@ -0,0 +1,42 @@ +assertSame($expected, $cp->get_profile_value(array( + 'value' => $value, + 'data' => array( + 'field_type' => $type, + 'field_show_novalue' => $show_novalue, + ), + ))); + } +}