diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aa0cb6..2b553ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ Changelog -------- +## 3.8.1 - 2022-01-23 + +### Fixed + +* [Linux] Avoid type issue when checking if \STDOUT is defined. [#185](/~https://github.com/thephpleague/climate/issues/185) + +-------- + ## 3.8.0 - 2022-01-22 ### Changed diff --git a/src/Util/System/Linux.php b/src/Util/System/Linux.php index 7ce6016..eae9f08 100644 --- a/src/Util/System/Linux.php +++ b/src/Util/System/Linux.php @@ -88,7 +88,7 @@ protected function systemHasAnsiSupport() } # If we're running in a web context then we can't use stdout - if (!defined(\STDOUT)) { + if (!defined('STDOUT')) { return false; } diff --git a/tests/AnsiTest.php b/tests/AnsiTest.php index 8cfec16..1268edb 100644 --- a/tests/AnsiTest.php +++ b/tests/AnsiTest.php @@ -107,4 +107,22 @@ public function it_will_force_ansi_off_on_an_ansi_system() $this->cli->out("I am green"); } + + + /** + * Ensure we can check if stdout is defined safely. + * /~https://github.com/thephpleague/climate/issues/185 + */ + public function test6() + { + $system = new Linux(); + $util = new UtilFactory($system); + $this->cli->setUtil($util); + + $this->shouldWrite("\e[m\e[32mI am green\e[0m\e[0m"); + $this->shouldHavePersisted(); + + $this->cli->out("I am green"); + self::assertTrue(true); + } }