From 5552f5ee7250ab9536e2eacf21cb3dbf9e67964a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 9 Feb 2020 02:17:48 -0500 Subject: [PATCH] Accept empty values for profile birthday --- src/Module/Settings/Profile/Index.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Module/Settings/Profile/Index.php b/src/Module/Settings/Profile/Index.php index d8227d4aea..51c428de7c 100644 --- a/src/Module/Settings/Profile/Index.php +++ b/src/Module/Settings/Profile/Index.php @@ -40,16 +40,16 @@ class Index extends BaseSettings Hook::callAll('profile_post', $_POST); - $dob = Strings::escapeHtml(trim($_POST['dob'] ?? '0000-00-00')); + $dob = trim($_POST['dob'] ?? ''); - $y = substr($dob, 0, 4); - if ((!ctype_digit($y)) || ($y < 1900)) { - $ignore_year = true; - } else { - $ignore_year = false; - } + if ($dob && !in_array($dob, ['0000-00-00', DBA::NULL_DATE])) { + $y = substr($dob, 0, 4); + if ((!ctype_digit($y)) || ($y < 1900)) { + $ignore_year = true; + } else { + $ignore_year = false; + } - if (!in_array($dob, ['0000-00-00', DBA::NULL_DATE])) { if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) { $ignore_year = true; $dob = substr($dob, 5);