![]() |
[F] Birthday without day [C-StefanT] - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: Community Archive (https://community.mybb.com/forum-106.html) +--- Forum: Archived Forums (https://community.mybb.com/forum-143.html) +---- Forum: Archived Development and Support (https://community.mybb.com/forum-155.html) +----- Forum: Archived Bug Reports (https://community.mybb.com/forum-74.html) +------ Forum: MyBB 1.4.6 (https://community.mybb.com/forum-116.html) +------ Thread: [F] Birthday without day [C-StefanT] (/thread-50833.html) Pages:
1
2
|
[F] Birthday without day [C-StefanT] - Michael S. - 2009-06-04 If you do not choose the day of your birthday and just the month and the year you get this on the profile page: Quote:Date of Birth: 00.11.83 (25 years old)Another user reported that in his forums the date of last day of the month before is shown if he does not choose a day. RE: Birthday without day - Tomm M - 2009-06-05 I've been playing this morning with this. It seems, with some date formats, an empty month can interfere too. The only way I've managed to 100% prevent this bug is this; in ./inc/datahandlers/user.php, find:
Add above:
RE: Birthday without day - Martin M. - 2009-06-08 If it's already under 1 it would give an invalid birthday though. As it is int validated it would be 0 if no input is given.. RE: Birthday without day - Tomm M - 2009-06-10 (2009-06-08, 07:40 AM)CraKteR Wrote: If it's already under 1 it would give an invalid birthday though. No, it doesn't - that's why I made that to pull it under 0. Making it int validated makes it 0, which means no input. MyBB then does this:
This if statement is where the error is activated, but there is no $birthday['day'], so if the user inputs nothing then the error doesn't get activated. Making it -1 gives $birthday['day'] a value, therefore going through the if statement. Further reinforcing the fact that I should never eat and develop at the same time, this has the same effect but I think is a better fix:
If there isn't a day and month (as required) the error is shown. RE: Birthday without day - Martin M. - 2009-06-10 (2009-06-10, 08:56 AM)Tomm M Wrote:Since it is int 0 means 0, not no input.(2009-06-08, 07:40 AM)CraKteR Wrote: If it's already under 1 it would give an invalid birthday though. Why not just delete the line with the check that it's inputted, because it will check that it is above 1 anyways. Since it is intval'ed it will be a number anyways. So no input means 0 which will through an error. to
That way it will give an invalid_birthday error because $birthday['day'] is below 1. That line is unnecessary because it's intval'ed. RE: Birthday without day - Ryan Gordon - 2009-06-10 I do believe CraKteR is correct. Intval will return 0 if it is not something that it can convert to an integer. Therefore 0 is the input that it sees, not null or an empty string. RE: Birthday without day - Tomm M - 2009-06-10 I guess "no input" is not really what I'm trying to say... Not trying to insult intelligence, but just to explain what I mean:
$content is the birthday['day'], intval'd would mean that this is now 0 ($test). Put through the if statement, it returns false. It's the same that happens in this bug - because $birthday['day'] is 0, it doesn't go through the if statement, and the invalid birthday error isn't returned. RE: Birthday without day - Martin M. - 2009-06-10 That's why you can remove the line with ease. It already throws an error if day is < 1 (if that line isn't there), no need for another error message as it would be redundant code.
RE: Birthday without day - Ryan Gordon - 2009-06-10 (2009-06-10, 03:28 PM)Tomm M Wrote: I guess "no input" is not really what I'm trying to say... Not trying to insult intelligence, but just to explain what I mean: Why is why CraKteR's fix of removing that one if statement all together is better. RE: Birthday without day - Tomm M - 2009-06-10 (2009-06-10, 03:46 PM)Ryan Gordon Wrote: Why is why CraKteR's fix of removing that one if statement all together is better. Like I said... I was just explaining... |