ソースを参照

Do not trigger the error in cli

Mark Scherer 10 年 前
コミット
c43ac2e583
1 ファイル変更1 行追加1 行削除
  1. 1 1
      src/Controller/Controller.php

+ 1 - 1
src/Controller/Controller.php

@@ -47,7 +47,7 @@ class Controller extends CakeController {
 	 * @return void
 	 * @return void
 	 */
 	 */
 	public function afterFilter(Event $event) {
 	public function afterFilter(Event $event) {
-		if (Configure::read('App.monitorHeaders') && $this->name !== 'Error') {
+		if (Configure::read('App.monitorHeaders') && $this->name !== 'Error' && php_sapi_name() !== 'cli') {
 			if (headers_sent($filename, $linenum)) {
 			if (headers_sent($filename, $linenum)) {
 				$message = sprintf('Headers already sent in %s on line %s', $filename, $linenum);
 				$message = sprintf('Headers already sent in %s on line %s', $filename, $linenum);
 				if (Configure::read('debug')) {
 				if (Configure::read('debug')) {