mirror of
https://github.com/friendica/friendica
synced 2024-11-10 09:42:54 +00:00
bug #511 - if birth year supplied but not a month or day, force a sane default. PHP datetime functions don't handle zero very well.
This commit is contained in:
parent
ee0def3ef5
commit
79fb5509ed
1 changed files with 7 additions and 0 deletions
|
@ -42,6 +42,13 @@ function profiles_post(&$a) {
|
|||
$day = intval($_POST['day']);
|
||||
if(($day > $mtab[$month]) || ($day < 0))
|
||||
$day = 0;
|
||||
|
||||
// It's OK to have an empty (0) year, but if you supplied a year you have to have a non-zero month and day
|
||||
if($year && ! $month)
|
||||
$month = 1;
|
||||
if($year && ! $day)
|
||||
$day = 1;
|
||||
|
||||
$dob = '0000-00-00';
|
||||
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day);
|
||||
|
||||
|
|
Loading…
Reference in a new issue