|
[F] Birthday without day [C-StefanT]
|
|
06-04-2009, 09:10 PM
Post: #1
|
|||
|
|||
|
[F] Birthday without day [C-StefanT]
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. Greets, Michael -------------
|
|||
|
06-05-2009, 09:02 AM
Post: #2
|
|||
|
|||
|
RE: Birthday without day
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: PHP Code: // Error if a day and month exists, and the birthday day and range is not in rangeAdd above: PHP Code: // Pull below 0 to hit error if no input is given |
|||
|
06-08-2009, 07:40 AM
(This post was last modified: 06-08-2009 07:40 AM by Martin M..)
Post: #3
|
|||
|
|||
|
RE: Birthday without day
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..
|
|||
|
06-10-2009, 08:56 AM
Post: #4
|
|||
|
|||
RE: Birthday without day
(06-08-2009 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: PHP Code: if($birthday['day'] && $birthday['month'])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: PHP Code: // Error if a day and month exists, and the birthday day and range is not in rangeIf there isn't a day and month (as required) the error is shown. |
|||
|
06-10-2009, 11:16 AM
(This post was last modified: 06-10-2009 11:25 AM by Martin M..)
Post: #5
|
|||
|
|||
RE: Birthday without day
(06-10-2009 08:56 AM)Tomm M Wrote:Since it is int 0 means 0, not no input.(06-08-2009 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. PHP Code: if($birthday['day'] && $birthday['month'])PHP Code: if($birthday['day'] < 1 || $birthday['day'] > 31 || $birthday['month'] < 1 || $birthday['month'] > 12 || ($birthday['month'] == 2 && $birthday['day'] > 29))That way it will give an invalid_birthday error because $birthday['day'] is below 1. That line is unnecessary because it's intval'ed. |
|||
|
06-10-2009, 01:55 PM
Post: #6
|
|||
|
|||
|
RE: Birthday without day
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.
|
|||
|
06-10-2009, 03:28 PM
(This post was last modified: 06-10-2009 03:29 PM by Tomm M.)
Post: #7
|
|||
|
|||
|
RE: Birthday without day
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:
PHP Code: $content = ''; // No input from the birthday day$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. |
|||
|
06-10-2009, 03:39 PM
(This post was last modified: 06-10-2009 03:39 PM by Martin M..)
Post: #8
|
|||
|
|||
|
RE: Birthday without day
That's why you can remove the
PHP Code: if($birthday['day'] && $birthday['month']) |
|||
|
06-10-2009, 03:46 PM
Post: #9
|
|||
|
|||
RE: Birthday without day
(06-10-2009 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. |
|||
|
06-10-2009, 04:02 PM
Post: #10
|
|||
|
|||
| RE: Birthday without day | |||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)
Search
Member List
Calendar
Help

![[Image: donation_drive_sig.png]](http://mybboard.net/assets/images/donation_drive_sig.png)

