Skip to content

Commit c4cc98b

Browse files
Merge branch '7.4' into 8.0
* 7.4: Use phpunit attribute Remove some implicit bool type juggling [Scheduler] Fix `scheduler.task` tag arguments optionality use false instead of null to hide the currency symbol [FrameworkBundle] Fix block type from `OK` to `ERROR` when local vault is disabled in `SecretsRemoveCommand` run tests with PHPUnit 12.1 on PHP >= 8.3 Fix wrong boolean values minor #61328 [FrameworkBundle] Decouple ControllerResolverTest from HttpKernel (nicolas-grekas) [Messenger] Fix NoAutoAckStamp handling in Worker::flush() [DependencyInjection] Dump XML using plain PHP, no DOM needed
2 parents db98876 + f7f8c65 commit c4cc98b

File tree

5 files changed

+36
-18
lines changed

5 files changed

+36
-18
lines changed

ExecutableFinder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public function find(string $name, ?string $default = null, array $extraDirs = [
6363
}
6464

6565
$dirs = array_merge(
66-
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
66+
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path') ?: ''),
6767
$extraDirs
6868
);
6969

7070
$suffixes = $this->suffixes;
7171
if ('\\' === \DIRECTORY_SEPARATOR) {
72-
$pathExt = getenv('PATHEXT');
72+
$pathExt = getenv('PATHEXT') ?: '';
7373
$suffixes = array_merge($suffixes, $pathExt ? explode(\PATH_SEPARATOR, $pathExt) : ['.exe', '.bat', '.cmd', '.com']);
7474
}
7575
$suffixes = '' !== pathinfo($name, \PATHINFO_EXTENSION) ? array_merge([''], $suffixes) : array_merge($suffixes, ['']);

Pipes/AbstractPipes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ protected function unblock(): void
7272
}
7373

7474
foreach ($this->pipes as $pipe) {
75-
stream_set_blocking($pipe, 0);
75+
stream_set_blocking($pipe, false);
7676
}
7777
if (\is_resource($this->input)) {
78-
stream_set_blocking($this->input, 0);
78+
stream_set_blocking($this->input, false);
7979
}
8080

8181
$this->blocked = false;
@@ -97,7 +97,7 @@ protected function write(): ?array
9797
if (!$input->valid()) {
9898
$input = null;
9999
} elseif (\is_resource($input = $input->current())) {
100-
stream_set_blocking($input, 0);
100+
stream_set_blocking($input, false);
101101
} elseif (!isset($this->inputBuffer[0])) {
102102
if (!\is_string($input)) {
103103
if (!\is_scalar($input)) {

Tests/ExecutableFinderTest.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\Component\Process\ExecutableFinder;
17+
use Symfony\Component\Process\Process;
1718

1819
/**
1920
* @author Chris Smith <chris@cs278.org>
@@ -122,17 +123,11 @@ public function testFindWithOpenBaseDir()
122123
$this->markTestSkipped('Cannot test when open_basedir is set');
123124
}
124125

125-
putenv('PATH='.\dirname(\PHP_BINARY));
126-
$initialOpenBaseDir = ini_set('open_basedir', \dirname(\PHP_BINARY).\PATH_SEPARATOR.'/');
127-
128-
try {
129-
$finder = new ExecutableFinder();
130-
$result = $finder->find($this->getPhpBinaryName());
126+
$process = new Process([\PHP_BINARY, '-d', 'open_basedir='.\dirname(\PHP_BINARY).\PATH_SEPARATOR.'/', __DIR__.'/Fixtures/open_basedir.php']);
127+
$process->run();
128+
$result = $process->getOutput();
131129

132-
$this->assertSamePath(\PHP_BINARY, $result);
133-
} finally {
134-
ini_set('open_basedir', $initialOpenBaseDir);
135-
}
130+
$this->assertSamePath(\PHP_BINARY, $result);
136131
}
137132

138133
#[RunInSeparateProcess]

Tests/Fixtures/open_basedir.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
require_once __DIR__.'/../../ExecutableFinder.php';
13+
14+
use Symfony\Component\Process\ExecutableFinder;
15+
16+
putenv('PATH='.dirname(PHP_BINARY));
17+
18+
function getPhpBinaryName(): string
19+
{
20+
return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : '');
21+
}
22+
23+
echo (new ExecutableFinder())->find(getPhpBinaryName());

Tests/PipeStdinInStdoutStdErrStreamSelect.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
$read = [\STDIN];
1818
$write = [\STDOUT, \STDERR];
1919

20-
stream_set_blocking(\STDIN, 0);
21-
stream_set_blocking(\STDOUT, 0);
22-
stream_set_blocking(\STDERR, 0);
20+
stream_set_blocking(\STDIN, false);
21+
stream_set_blocking(\STDOUT, false);
22+
stream_set_blocking(\STDERR, false);
2323

2424
$out = $err = '';
2525
while ($read || $write) {

0 commit comments

Comments
 (0)