Skip to content

Commit 176fea9

Browse files
authored
Merge pull request #1481 from nextcloud/bump-symfony-console
chore: update symfony/console to 5.4.24
2 parents 350e2a4 + 2922ee9 commit 176fea9

File tree

14 files changed

+73
-52
lines changed

14 files changed

+73
-52
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"sabre/dav": "^4.4.0",
4949
"scssphp/scssphp": "^1.11",
5050
"stecman/symfony-console-completion": "^0.11.0",
51-
"symfony/console": "5.4.19",
51+
"symfony/console": "^5.4.24",
5252
"symfony/event-dispatcher": "4.4.30",
5353
"symfony/event-dispatcher-contracts": "1.1.9",
5454
"symfony/http-foundation": "^5.4.10",

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer/installed.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4627,17 +4627,17 @@
46274627
},
46284628
{
46294629
"name": "symfony/console",
4630-
"version": "v5.4.19",
4631-
"version_normalized": "5.4.19.0",
4630+
"version": "v5.4.24",
4631+
"version_normalized": "5.4.24.0",
46324632
"source": {
46334633
"type": "git",
46344634
"url": "https://github.com/symfony/console.git",
4635-
"reference": "dccb8d251a9017d5994c988b034d3e18aaabf740"
4635+
"reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8"
46364636
},
46374637
"dist": {
46384638
"type": "zip",
4639-
"url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740",
4640-
"reference": "dccb8d251a9017d5994c988b034d3e18aaabf740",
4639+
"url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8",
4640+
"reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8",
46414641
"shasum": ""
46424642
},
46434643
"require": {
@@ -4675,7 +4675,7 @@
46754675
"symfony/lock": "",
46764676
"symfony/process": ""
46774677
},
4678-
"time": "2023-01-01T08:32:19+00:00",
4678+
"time": "2023-05-26T05:13:16+00:00",
46794679
"type": "library",
46804680
"installation-source": "dist",
46814681
"autoload": {
@@ -4704,12 +4704,12 @@
47044704
"homepage": "https://symfony.com",
47054705
"keywords": [
47064706
"cli",
4707-
"command line",
4707+
"command-line",
47084708
"console",
47094709
"terminal"
47104710
],
47114711
"support": {
4712-
"source": "https://github.com/symfony/console/tree/v5.4.19"
4712+
"source": "https://github.com/symfony/console/tree/v5.4.24"
47134713
},
47144714
"funding": [
47154715
{

composer/installed.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name' => 'nextcloud/3rdparty',
44
'pretty_version' => 'dev-master',
55
'version' => 'dev-master',
6-
'reference' => '48b720f4253fffbb463b96fc81248e9f3588e2e0',
6+
'reference' => '350e2a466ff849c59386e817c849f9e441fc10ab',
77
'type' => 'library',
88
'install_path' => __DIR__ . '/../',
99
'aliases' => array(),
@@ -310,7 +310,7 @@
310310
'nextcloud/3rdparty' => array(
311311
'pretty_version' => 'dev-master',
312312
'version' => 'dev-master',
313-
'reference' => '48b720f4253fffbb463b96fc81248e9f3588e2e0',
313+
'reference' => '350e2a466ff849c59386e817c849f9e441fc10ab',
314314
'type' => 'library',
315315
'install_path' => __DIR__ . '/../',
316316
'aliases' => array(),
@@ -689,9 +689,9 @@
689689
'dev_requirement' => false,
690690
),
691691
'symfony/console' => array(
692-
'pretty_version' => 'v5.4.19',
693-
'version' => '5.4.19.0',
694-
'reference' => 'dccb8d251a9017d5994c988b034d3e18aaabf740',
692+
'pretty_version' => 'v5.4.24',
693+
'version' => '5.4.24.0',
694+
'reference' => '560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8',
695695
'type' => 'library',
696696
'install_path' => __DIR__ . '/../symfony/console',
697697
'aliases' => array(),

symfony/console/Command/Command.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,9 @@ public function getNativeDefinition()
429429
* @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
430430
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
431431
*
432-
* @throws InvalidArgumentException When argument mode is not valid
433-
*
434432
* @return $this
433+
*
434+
* @throws InvalidArgumentException When argument mode is not valid
435435
*/
436436
public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
437437
{
@@ -450,9 +450,9 @@ public function addArgument(string $name, int $mode = null, string $description
450450
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
451451
* @param mixed $default The default value (must be null for InputOption::VALUE_NONE)
452452
*
453-
* @throws InvalidArgumentException If option mode is invalid or incompatible
454-
*
455453
* @return $this
454+
*
455+
* @throws InvalidArgumentException If option mode is invalid or incompatible
456456
*/
457457
public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
458458
{

symfony/console/Command/CompleteCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
155155
throw $e;
156156
}
157157

158-
return self::FAILURE;
158+
return 2;
159159
}
160160

161-
return self::SUCCESS;
161+
return 0;
162162
}
163163

164164
private function createCompletionInput(InputInterface $input): CompletionInput

symfony/console/Command/DumpCompletionCommand.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8585
if ($input->getOption('debug')) {
8686
$this->tailDebugLog($commandName, $output);
8787

88-
return self::SUCCESS;
88+
return 0;
8989
}
9090

9191
$shell = $input->getArgument('shell') ?? self::guessShell();
@@ -102,12 +102,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
102102
$output->writeln(sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', implode('", "', $supportedShells)));
103103
}
104104

105-
return self::INVALID;
105+
return 2;
106106
}
107107

108108
$output->write(str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, $this->getApplication()->getVersion()], file_get_contents($completionFile)));
109109

110-
return self::SUCCESS;
110+
return 0;
111111
}
112112

113113
private static function guessShell(): string
@@ -132,8 +132,14 @@ private function tailDebugLog(string $commandName, OutputInterface $output): voi
132132
*/
133133
private function getSupportedShells(): array
134134
{
135-
return array_map(function ($f) {
136-
return pathinfo($f, \PATHINFO_EXTENSION);
137-
}, glob(__DIR__.'/../Resources/completion.*'));
135+
$shells = [];
136+
137+
foreach (new \DirectoryIterator(__DIR__.'/../Resources/') as $file) {
138+
if (str_starts_with($file->getBasename(), 'completion.') && $file->isFile()) {
139+
$shells[] = $file->getExtension();
140+
}
141+
}
142+
143+
return $shells;
138144
}
139145
}

symfony/console/Formatter/OutputFormatterStyle.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ public function apply(string $text)
9696
{
9797
if (null === $this->handlesHrefGracefully) {
9898
$this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
99-
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
99+
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100)
100+
&& !isset($_SERVER['IDEA_INITIAL_DIRECTORY']);
100101
}
101102

102103
if (null !== $this->href && $this->handlesHrefGracefully) {

symfony/console/Helper/QuestionHelper.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,18 @@ private function doAsk(OutputInterface $output, Question $question)
128128
}
129129

130130
if (false === $ret) {
131+
$isBlocked = stream_get_meta_data($inputStream)['blocked'] ?? true;
132+
133+
if (!$isBlocked) {
134+
stream_set_blocking($inputStream, true);
135+
}
136+
131137
$ret = $this->readInput($inputStream, $question);
138+
139+
if (!$isBlocked) {
140+
stream_set_blocking($inputStream, false);
141+
}
142+
132143
if (false === $ret) {
133144
throw new MissingInputException('Aborted.');
134145
}
@@ -500,13 +511,11 @@ private function isInteractiveInput($inputStream): bool
500511
return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r'));
501512
}
502513

503-
if (!\function_exists('exec')) {
514+
if (!\function_exists('shell_exec')) {
504515
return self::$stdinIsInteractive = true;
505516
}
506517

507-
exec('stty 2> /dev/null', $output, $status);
508-
509-
return self::$stdinIsInteractive = 1 !== $status;
518+
return self::$stdinIsInteractive = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
510519
}
511520

512521
/**

symfony/console/Helper/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ private function calculateColumnsWidth(iterable $groups)
805805
$textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
806806
$textLength = Helper::width($textContent);
807807
if ($textLength > 0) {
808-
$contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
808+
$contentColumns = mb_str_split($textContent, ceil($textLength / $cell->getColspan()));
809809
foreach ($contentColumns as $position => $content) {
810810
$row[$i + $position] = $content;
811811
}

0 commit comments

Comments
 (0)