Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

FIX for fatal error: invalid date format problem!

Quote Reply
FIX for fatal error: invalid date format problem!
I have read many posts in here about the nph-build.cgi script returning the error fatal error: invalid date format... yadayada... but nobody has yet posted a good solution to the problem. I had the same problem occur and here is the skinny....

The basic problem has been established... it is that when you (or your server host) upgrades to Perl version 5.006 it does not correctly render the Time::Local subroutine which is called from various scripts in links 2.0.

Strangly enough the solution is absurdely simple. In your links.cfg script you would make one alteration... you simply add a 1 to the end of the $year

So for example on (my line 292) in links.cfg It would look like:
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year1);

instead of:
$time = &Time::Local::timelocal(0,0,0, $day, $months{$mon}, $year);

Just do this and it should solve all of your problems.

It's not really y2k related, but more y2k.1 related problem. :)

The year is sent as a three digit variable in the new perl configuration. So unfortunately, you will actually have to change this each year... i.e. next year to a 2... but it's the best I could come up with for now!
Good luck.


Quote Reply
Re: FIX for fatal error: invalid date format problem! In reply to
Glad someone figured it out. Since my hosting company is still using Perl 5.005, I have not seen the need to test the script to work with Perl 5.006.

I would recommend adding this Thread in the Resource section under Links -> FAQ or in the Perl section.

Regards,

Eliot Lee
Quote Reply
Re: FIX for fatal error: invalid date format problem! In reply to
I am not sure, if this really related to Perl 5.006. I am using both Links 2.0 and 2.01 along with Perl 5.006 and have never stumbled across invalid date formats...

Thomas
http://www.japanreference.com
Quote Reply
Re: FIX for fatal error: invalid date format problem! In reply to
It is...your hosting company may not have upgraded the TIME and DATE modules since many programmers have reported bugs with those modules.

Regards,

Eliot Lee
Quote Reply
Re: FIX for fatal error: invalid date format problem! In reply to
It seems this fix also makes the script unable to mark links as "new" when rebuilding pages. Anyone else encountered this? Any solution to the problem?
TIA

Quote Reply
Re: [designerx] FIX for fatal error: invalid date format problem! In reply to
Why can't we just replace:

Code:


exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1900;


with:

Code:


exists $months{$mon} or return undef;
$day = int($day); $year = $year - 1901;


?

Is there some solution that would not involve having to change the code every 365 days or so (and which would not create other problems by fixing the one problem?)? Also, Is this a problem is Links MySQL too, btw?
--Sanguinarius
Your resident vampire ;P
http://www.sanguinarius.org/
Post deleted by felicin In reply to
Quote Reply
Re: [designerx] FIX for fatal error: invalid date format problem! In reply to
Is adding a 1 to the year still the best fix that has been found? I have recently moved my site to another server and this problem has presented itself. I did try adding the one, but it did not appear to build the "what's new".
Quote Reply
Re: [designerx] FIX for fatal error: invalid date format problem! In reply to
Mmmm, I don't think the error is in the links.cfg file. The fix must be somewhere else in the scripts...Unimpressed
Quote Reply
Re: [rcull] FIX for fatal error: invalid date format problem! In reply to
Are you using 2.1 or 2.0?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] FIX for fatal error: invalid date format problem! In reply to
I am using 2.0, but someone else here said 2.1 does not resolve the problem.
Quote Reply
Re: [rcull] FIX for fatal error: invalid date format problem! In reply to
SmileFor what it's worth!!! I have found, or finally understood the problem "invalid date format" Tongue



The problem comes as described in the format change in perl. The links program has no problems in itself. The problem is when you have been running on an older perl program the date is formatted in your links.db file on older entries like-

3|Auto Body Repair News Magazine|http://www.abrn.com/|6-Apr-98|Resources/Information|The voice of the collision repair industry.|webmaster|jsims@advanstar.com|109|No|No|1|1|Yes

Newer entries are formatted like-

3|Auto Body Repair News Magazine|http://www.abrn.com/|6-Apr-1998|Resources/Information|The voice of the collision repair industry.|webmaster|jsims@advanstar.com|109|No|No|1|1|Yes

|6-Apr-98| |6-Apr-1998|

By using a multi-file find and replace program you can just replace -9 with -199

I think this is a good fixSly, I hope!
Quote Reply
Re: [rcull] FIX for fatal error: invalid date format problem! In reply to
I also had a problem with errors in the build and add routines after moving to a server with a newer version of Perl, and I was getting blank What's New pages.

What I did that finally worked:

1) downloaded the older Local.pm module attached in this thread here:

http://www.gossamer-threads.com/...i?post=233833#233833

2) Put that in the same directory with links.cfg

3) Referenced the Local.pm as described in that same post:
require "Local.pm";

4) Modified those 2 digit dates by doing a global find and replace on my database as you've described above

find -01 replace -2001
find -02 replace -2002

5) Removed the various kludges and fixes I read elsewhere regarding

$year1 or -1901 and restored the script to the way it was.


6) did a new build and checked the build all went okay and

Whew!

Last edited by:

memobug: Nov 28, 2003, 4:00 AM