Skip to content

Commit 229e1ab

Browse files
committed
TL-46723 scssphp: Don't close a stream that failed to open
1 parent 9b2859f commit 229e1ab

File tree

2 files changed

+10
-47
lines changed

2 files changed

+10
-47
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php: [ '8.1', '8.2' ]
16+
php: [ '8.2' ]
1717
extensions: [ '' ]
1818
os: [ubuntu-latest]
1919
include:
@@ -58,48 +58,3 @@ jobs:
5858

5959
- name: Run tests
6060
run: vendor/bin/phpunit --colors=always
61-
62-
static_analysis:
63-
name: Static analysis
64-
runs-on: ubuntu-latest
65-
66-
steps:
67-
- name: Checkout
68-
uses: actions/checkout@v4
69-
70-
- name: Setup PHP
71-
uses: shivammathur/setup-php@v2
72-
with:
73-
coverage: "none"
74-
php-version: "8.2"
75-
ini-file: development
76-
77-
- name: Install dependencies
78-
run: composer update --ansi --no-progress
79-
80-
- name: Install phpstan
81-
run: composer bin phpstan update --ansi --no-progress
82-
83-
- name: Run phpstan
84-
run: vendor-bin/phpstan/vendor/bin/phpstan analyse --ansi --no-progress
85-
86-
coding_styles:
87-
name: Coding styles
88-
runs-on: ubuntu-latest
89-
90-
steps:
91-
- name: Checkout
92-
uses: actions/checkout@v4
93-
94-
- name: Setup PHP
95-
uses: shivammathur/setup-php@v2
96-
with:
97-
coverage: "none"
98-
php-version: "8.2"
99-
ini-file: development
100-
101-
- name: Install dependencies
102-
run: composer update --ansi --no-progress
103-
104-
- name: Run phpcs
105-
run: vendor/bin/phpcs --extensions=php bin src tests *.php

src/Logger/StreamLogger.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($stream, $closeOnDestruct = false)
3737
*/
3838
public function __destruct()
3939
{
40-
if ($this->closeOnDestruct) {
40+
if ($this->closeOnDestruct && $this->stream) {
4141
fclose($this->stream);
4242
}
4343
}
@@ -47,6 +47,10 @@ public function __destruct()
4747
*/
4848
public function warn($message, $deprecation = false)
4949
{
50+
if (!$this->stream) {
51+
return;
52+
}
53+
5054
$prefix = ($deprecation ? 'DEPRECATION ' : '') . 'WARNING: ';
5155

5256
fwrite($this->stream, $prefix . $message . "\n\n");
@@ -57,6 +61,10 @@ public function warn($message, $deprecation = false)
5761
*/
5862
public function debug($message)
5963
{
64+
if (!$this->stream) {
65+
return;
66+
}
67+
6068
fwrite($this->stream, $message . "\n");
6169
}
6270
}

0 commit comments

Comments
 (0)