FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » Bday code incapable of recording dates before 1969
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Bday code incapable of recording dates before 1969 [message #3031] Fri, 07 June 2002 19:50 Go to next message
tgaastra is currently offline  tgaastra   United States
Messages: 90
Registered: June 2002
Karma: 0
Member
I've noticed that the birthday code in 2.0 is incapable of recording dates before 1969, which is probably due to using some of the timestamping functions in PHP.

When I used 1.2.7, I eventually ended up gutting the bday code and replacing it with new code based on the DATE type structure in SQL... Is there a reason why a packed integer continues to be used for dates in 2.0?
Re: Bday code incapable of recording dates before 1969 [message #3032 is a reply to message #3031] Fri, 07 June 2002 19:54 Go to previous messageGo to next message
hackie is currently offline  hackie   Canada
Messages: 177
Registered: January 2002
Karma: 0
Senior Member
Core Developer

tgaastra wrote on Fri, 07 June 2002 15:50

I've noticed that the birthday code in 2.0 is incapable of recording dates before 1969, which is probably due to using some of the timestamping functions in PHP.

When I used 1.2.7, I eventually ended up gutting the bday code and replacing it with new code based on the DATE type structure in SQL... Is there a reason why a packed integer continues to be used for dates in 2.0?


Strange, I'm able to set bday's before 1969 on our forum here.


cc intelligence.c -o intelligence
$ ./intelligence
Segmentation fault
Re: Bday code incapable of recording dates before 1969 [message #3034 is a reply to message #3032] Fri, 07 June 2002 21:28 Go to previous messageGo to next message
tgaastra is currently offline  tgaastra   United States
Messages: 90
Registered: June 2002
Karma: 0
Member
Are you sure? Have you gone back and looked?

I can put the number as (for instance) March 15 1955, but when I read the profile in again its March 15 1969.

Checking an actual query of the entry in fud2_users comes back with bday being 19690315.

Without digging too much into things, if I had to hazard a guess, I'd say its the fmt_year function in register.php.

It uses mktime passed into date to return a formated year, but mktime returns a timestamp, which is incapable (at least under RedHat 7.3 Linux) of representing a date earlier than the epoch.

Take this little snippet of php:
<html>
<head><title>Foo</title></head>
<body>
<?php
print(date("Y", mktime(1,1,1,1,1,1955)));
?>
</body>
</html>

On my system, this prints 1969.

Probably what needs to happen is that fmt_year is going to have to do a little guess work on its own rather than rely on mktime.

If people just use two digits, assume that just like the YEAR format does in SQL that its between 1970 and 2069.

Of course, if you used the DATE format, it would do that for you. Smile



Re: Bday code incapable of recording dates before 1969 [message #3035 is a reply to message #3031] Fri, 07 June 2002 21:47 Go to previous messageGo to next message
hackie is currently offline  hackie   Canada
Messages: 177
Registered: January 2002
Karma: 0
Senior Member
Core Developer

Well, the problem is that I'm unable to replicate the bug here :).. You try it here? I've entered my bday as 1950 and it worked fine, that is obviously well before the epoh.

Trying this:
<?
echo date("Y", mktime(1,1,1,1,1,1920))."\n";
?>

:
on my computer which is linux-2.4.18 with glibc 2.2.4 produces:

1920

so it seems to work fine, the limits appear to be 1902-2039.
The same behavior was also observed by me on FreeBSD 3.3.


cc intelligence.c -o intelligence
$ ./intelligence
Segmentation fault

[Updated on: Fri, 07 June 2002 21:47]

Report message to a moderator

Re: Bday code incapable of recording dates before 1969 [message #3036 is a reply to message #3034] Fri, 07 June 2002 21:48 Go to previous messageGo to next message
Olliver   Germany
Messages: 443
Registered: March 2002
Karma: 0
Senior Member
HI,
I'm using RH 7.3 and I ve just tried to set the birthday to a date before 1969. Actually it causes te date to be shown as xx.xx.1970 not 1969 but apart from that I can confirm that there's such a problem. My platform is Apache 1.3.23, php 4.2.1 and mysql 3.23.50
bye Ken

ps. oops 200 posts already Smile
Re: Bday code incapable of recording dates before 1969 [message #3037 is a reply to message #3031] Fri, 07 June 2002 21:50 Go to previous messageGo to next message
hackie is currently offline  hackie   Canada
Messages: 177
Registered: January 2002
Karma: 0
Senior Member
Core Developer

Err... okie.. fixing time.... stupid redhat Smile


linux development lesson #1: 90% of problems can be blamed on redhat.


cc intelligence.c -o intelligence
$ ./intelligence
Segmentation fault
Re: Bday code incapable of recording dates before 1969 [message #3038 is a reply to message #3037] Fri, 07 June 2002 21:58 Go to previous messageGo to next message
tgaastra is currently offline  tgaastra   United States
Messages: 90
Registered: June 2002
Karma: 0
Member
Oh well, just think of it as fixing the y2k38 bug a little bit in advance! Smile
Re: Bday code incapable of recording dates before 1969 [message #3039 is a reply to message #3038] Fri, 07 June 2002 22:36 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Fixed in latest CVS.

Affected file register.php.t


FUDforum Core Developer
Re: Bday code incapable of recording dates before 1969 [message #3041 is a reply to message #3039] Fri, 07 June 2002 23:15 Go to previous messageGo to next message
tgaastra is currently offline  tgaastra   United States
Messages: 90
Registered: June 2002
Karma: 0
Member
Thanks, I've got it in place, and it seems to work in the general case.

Re: Bday code incapable of recording dates before 1969 [message #3042 is a reply to message #3041] Fri, 07 June 2002 23:22 Go to previous message
hackie is currently offline  hackie   Canada
Messages: 177
Registered: January 2002
Karma: 0
Senior Member
Core Developer

tgaastra wrote on Fri, 07 June 2002 19:15

Thanks, I've got it in place, and it seems to work in the general case.




General case?


cc intelligence.c -o intelligence
$ ./intelligence
Segmentation fault
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Login problem using IE in FUD 1.2.4
Next Topic: Typo in moderator options FUD 2.0 RC6
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 03:54:33 GMT 2024

Total time taken to generate the page: 0.04015 seconds