8000 minor #58188 Don't use is_resource() on non-streams (nicolas-grekas) · rjd22/symfony@d7000e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit d7000e6

Browse files
committed
minor symfony#58188 Don't use is_resource() on non-streams (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- Don't use is_resource() on non-streams | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Prepares for https://wiki.php.net/rfc/resource_to_object_conversion Commits ------- b12b7a0 Don't use is_resource() on non-streams
2 parents 73ca0b7 + b12b7a0 commit d7000e6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Symfony/Component/Console/Terminal.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ private static function readFromProcess(string $command): ?string
158158

159159
$cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;
160160

161-
$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
162-
if (!\is_resource($process)) {
161+
if (!$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true])) {
163162
return null;
164163
}
165164

src/Symfony/Component/HttpKernel/Log/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __construct(?string $minLevel = null, $output = null, ?callable
6767

6868
$this->minLevelIndex = self::LEVELS[$minLevel];
6969
$this->formatter = $formatter ?: [$this, 'format'];
70-
if ($output && false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) {
70+
if ($output && false === $this->handle = \is_string($output) ? @fopen($output, 'a') : $output) {
7171
throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output));
7272
}
7373
}

src/Symfony/Component/Process/Process.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public function start(?callable $callback = null, array $env = [])
352352

353353
$this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
354354

355-
if (!\is_resource($this->process)) {
355+
if (!$this->process) {
356356
throw new RuntimeException('Unable to launch a new process.');
357357
}
358358
$this->status = self::STATUS_STARTED;
@@ -1456,8 +1456,9 @@ private function readPipes(bool $blocking, bool $close)
14561456
private function close(): int
14571457
{
14581458
$this->processPipes->close();
1459-
if (\is_resource($this->process)) {
1459+
if ($this->process) {
14601460
proc_close($this->process);
1461+
$this->process = null;
14611462
}
14621463
$this->exitcode = $this->processInformation['exitcode'];
14631464
$this->status = self::STATUS_TERMINATED;

0 commit comments

Comments
 (0)
0