2009-12-22 67 views
5

我有一些問題讓phpdoc正常運行。被大部分生成的文檔成功,但我得到以下警告多次:PHPDocumentor日期問題警告

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

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

Smarty的警告,因爲它只是產生一個我可以很容易地從代碼中刪除時間戳在渲染文檔的模板頂部。沒什麼大不了的。 phpDocumentor中的第一個錯誤我不確定。似乎只是分配一個日期給Smarty的模板:

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

也許我可以消除在Smarty模板和該行的所有的「日期」變量。

無論如何,這個警告也出現在生成的文檔中,並且索引頁僅顯示此警告。有什麼想法發生在這裏?我正在使用版本1.4.3,這裏是我的標誌/選項:

#!/usr/bin/env bash 
phpdoc \ 
    --title 'Asra Documentation' \ 
    --directory library/Asra \ 
    --target docs \ 
    --defaultcategoryname Asra \ 
    --defaultpackagename Asra \ 
    --quiet on \ 
    --output HTML:frames:phpedit 

回答

7

這是PHP 5.3的工作。由於給出的原因(依賴於系統設置是不安全的),PHP 5.3+要求您設置您的時區。

如果可以,請在bootstrap/init/settings文件中調用date_default_timezone_set()。您也可以使用specify it in an .htaccess file使其成爲您的代碼的非問題,如下所示:

php_value date.timezone America/Vancouver 
+1

是的,這是確切的原因。 @Typeoneerror:這是PHP 5.3特有的問題,而不是您實際使用的PHP代碼。每次代碼調用使用默認時區設置的PHP函數時,您都可能遇到同樣的問題。 – kiamlaluno 2009-12-22 17:39:15

+0

你們搖滾。我剛剛在phpdoc文件中添加了對date_default ..的調用。固定。 – typeoneerror 2009-12-22 17:56:01

+2

如果您的error_reporting設置爲E_ALL,則也會發生PHP 5.2。 E_STRICT – djn 2009-12-22 17:57:28