date() []

I had a user posting an odd error message over at FSI just the other day. He installed vBulletin 4.2.2 in his account (which isn’t a good idea to begin with as the forum will get suspended as soon as it is reported or their script detects the vBulletin installation) and when opening the forum homepage there was an error message that showed up quite a number of times with the line numbers in the source code varying.  The actual error message was:

Warning: date() []: It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/New_York’ for ‘EDT/-4.0/DST’ instead in …./includes/functions.php on line 4918

Never saw that error message before, and i installed a lot of vBulletin forums on different hosts. I guess this error is unique to and if i only could be arsed i would grab a copy of 4.2.2, install it in my test account and see if get the same error message. Anyway, took a few moments to figure out what was causing this and i narrowed it down to the server setup and their PHP installation. As the error message was not an actual error but a warning i went the easiest way and suppressed the PHP warnings by altering a core file of his vBulletin installation. Seems like my changes fixed the guys problems and he reported the vBulletin forum working fine afterwards.

So here is what i have changed. If you run into the same error message or warning, then it might be worth a shot making the changes i made to the core file. Grab a text editor of your choice and edit the /includes/class_core.php file. Locate the lines 5683-5685 which should look like

and change them to look like this

This will suppress those warnings and those warnings only (well, along the ones you get about deprecated functions) and not affect the functionality of the script.


Leave a Reply

Your email address will not be published.

I confirm