Skip to content

Commit e9da460

Browse files
authored
Merge pull request #7052 from jozefrebjak/fix-define-stdout-in-cli
fix: define of STDOUT in CLI init() method
2 parents 7cb8917 + 06a1ce9 commit e9da460

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

system/CLI/CLI.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ public static function init()
161161
static::parseCommandLine();
162162

163163
static::$initialized = true;
164-
} else {
164+
} elseif (! defined('STDOUT')) {
165165
// If the command is being called from a controller
166166
// we need to define STDOUT ourselves
167+
// For "! defined('STDOUT')" see: https://github.com/codeigniter4/CodeIgniter4/issues/7047
167168
define('STDOUT', 'php://output'); // @codeCoverageIgnore
168169
}
169170
}

0 commit comments

Comments
 (0)