Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPDocumentor date problem warnings

Tags:

php

phpdoc

smarty

I'm having some issues getting phpdoc to run correctly. The docs are being generated for the most part successfully, but I get the following warning many times:

Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting 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/Los_Angeles' for 'PST/-8.0/no DST' instead in /Users/ben/bin/PhpDocumentor/phpDocumentor/Converter.inc on line 5064

and

Warning: strftime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting 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/Los_Angeles' for 'PST/-8.0/no DST' instead in PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php on line 370

The Smarty warning I could easily remove from the code since it's just generating a timestamp at the top of the template in the rendered document. No biggie. The first error in the phpDocumentor I'm not sure about. Seems to be just assigning a date to Smarty for the template:

$templ->assign("date",date("r",time()));

Maybe I could just remove all the "date" variables in the Smarty templates and this line.

Anyway, this warning is in the generated docs as well and the index page just displays this warning. Any ideas what is happening here? I'm using version 1.4.3 and here are my flags/options:

#!/usr/bin/env bash
phpdoc \
    --title 'Asra Documentation' \
    --directory library/Asra \
    --target docs \
    --defaultcategoryname Asra \
    --defaultpackagename Asra \
    --quiet on \
    --output HTML:frames:phpedit
like image 398
typeoneerror Avatar asked Dec 22 '09 17:12

typeoneerror


1 Answers

This is PHP 5.3 at work. PHP 5.3+ demands that you set your timezone, for the reasons given (relying on the system settings is unsafe).

If you can, just call date_default_timezone_set() in your bootstrap/init/settings file. You can also specify it in an .htaccess file to make it a non-issue for your code, like this:

php_value date.timezone America/Vancouver
like image 61
zombat Avatar answered Oct 13 '22 23:10

zombat