2009-12-22 20 views
5

Sto riscontrando alcuni problemi nel far funzionare correttamente phpdoc. I documenti vengono generati per la maggior parte con successo, ma ottengo il seguente avviso molte volte:PHPDocumentor warning problem warning

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

e

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

L'avvertimento Smarty ho potuto facilmente rimuovere dal codice dal momento che è solo la generazione di un timestamp nella parte superiore del modello nel documento reso. No biggie. Il primo errore nel phpDocumentor di cui non sono sicuro. Sembra essere solo l'assegnazione di una data per Smarty per il modello:

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

Forse potrei semplicemente rimuovere tutte le variabili "data" nei modelli di Smarty e questa linea.

In ogni caso, questo avviso si trova anche nei documenti generati e la pagina dell'indice mostra solo questo avviso. Qualche idea su cosa sta succedendo qui? Sto usando la versione 1.4.3 e qui ci sono le mie bandiere/opzioni:

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

risposta

7

Questo è PHP 5.3 al lavoro. PHP 5.3+ richiede di impostare il fuso orario, per i motivi indicati (fare affidamento sulle impostazioni di sistema non è sicuro).

Se è possibile, è sufficiente chiamare date_default_timezone_set() nel file bootstrap/init/settings. È inoltre possibile specify it in an .htaccess file per rendere un non-problema per il codice, come questo:

php_value date.timezone America/Vancouver 
+1

Sì, questo è il motivo esatto. @Typeoneerror: è un problema specifico per PHP 5.3, non il codice PHP che stai effettivamente utilizzando. Potresti avere lo stesso problema ogni volta che il codice chiama una funzione PHP che usa l'impostazione predefinita del fuso orario. – kiamlaluno

+0

Ragazzi, rockate. Ho appena aggiunto una chiamata a date_default .. nel file phpdoc. Fisso. – typeoneerror

+2

Questo succede anche con PHP 5.2, se error_reporting è impostato su E_ALL | E_STRICT – djn