我有一個傳統應用程序,需要register_globals
和magic_quotes_gpc
才能啓用。我的error_reporting
設置爲E_ALL & ~E_DEPRECATED
,因爲我仍然希望看到任何警告。PHP 5.3棄用郵件顯示爲警告
當我運行PHP CLI我碰到下面的
$ php -d "error_reporting=E_ALL & ~E_DEPRECATED" -v
PHP Warning: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP Warning: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP 5.3.3 (cli) (built: Mar 30 2011 13:51:41)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
爲什麼顯示過時的消息作爲警告?他們不應該在E_DEPRECATED
的水平?
看來我得爲不顯示警告,讓他們走開
$ php -d "error_reporting=E_ALL & ~E_WARNING" -v
PHP 5.3.3 (cli) (built: Mar 30 2011 13:51:41)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans
我可以改變我的error_reporting
到E_ALL & ~E_DEPRECATED & ~E_WARNING
,但那就不會顯示我的web應用程序的警告。有什麼建議麼?我必須爲CLI使用單獨的php.ini
嗎?
它被編程爲E_WARNING。就是這樣。 (順便說一句,這兩個警告很容易解決。) – mario
你應該關閉這兩個指令。他們是糟糕的壞主意。 –
@OndřejMirtes剛剛引用了OP,因爲它似乎錯過了第一行:「我有一個需要register_globals和magic_quotes_gpc啓用的舊應用程序。」 –