Merge pull request #8260 from MrPetovan/bug/8252-fix-birthday-default

Accept empty values for profile birthday
This commit is contained in:
Philipp 2020-02-09 10:39:55 +01:00 committed by GitHub
commit 16acf1db95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,8 +40,9 @@ class Index extends BaseSettings
Hook::callAll('profile_post', $_POST); Hook::callAll('profile_post', $_POST);
$dob = Strings::escapeHtml(trim($_POST['dob'] ?? '0000-00-00')); $dob = trim($_POST['dob'] ?? '');
if ($dob && !in_array($dob, ['0000-00-00', DBA::NULL_DATE])) {
$y = substr($dob, 0, 4); $y = substr($dob, 0, 4);
if ((!ctype_digit($y)) || ($y < 1900)) { if ((!ctype_digit($y)) || ($y < 1900)) {
$ignore_year = true; $ignore_year = true;
@ -49,7 +50,6 @@ class Index extends BaseSettings
$ignore_year = false; $ignore_year = false;
} }
if (!in_array($dob, ['0000-00-00', DBA::NULL_DATE])) {
if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) { if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) {
$ignore_year = true; $ignore_year = true;
$dob = substr($dob, 5); $dob = substr($dob, 5);