Skip to content

Commit cb0102a

Browse files
committed
Merge branch '6.4' into 7.3
* 6.4: [String] Fix nodes singular [Console] Fix testing multiline question [Security][Validator] Review translations. [Security] Ignore target route when exiting impersonation
2 parents 53a8528 + 273fd29 commit cb0102a

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Helper/QuestionHelper.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,16 @@ private function readInput($inputStream, Question $question): string|false
516516
$ret = '';
517517
$cp = $this->setIOCodepage();
518518
while (false !== ($char = fgetc($multiLineStreamReader))) {
519-
if (\PHP_EOL === "{$ret}{$char}") {
519+
if ("\x4" === $char || \PHP_EOL === "{$ret}{$char}") {
520520
break;
521521
}
522522
$ret .= $char;
523523
}
524524

525+
if (stream_get_meta_data($inputStream)['seekable']) {
526+
fseek($inputStream, ftell($multiLineStreamReader));
527+
}
528+
525529
return $this->resetIOCodepage($cp, $ret);
526530
}
527531

Tester/TesterTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ private static function createStream(array $inputs)
169169

170170
foreach ($inputs as $input) {
171171
fwrite($stream, $input.\PHP_EOL);
172+
173+
if (str_contains($input, \PHP_EOL)) {
174+
fwrite($stream, "\x4");
175+
}
172176
}
173177

174178
rewind($stream);

Tests/Helper/QuestionHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ public function testAskMultilineResponseWithWithCursorInMiddleOfSeekableInputStr
519519
$question->setMultiline(true);
520520

521521
$this->assertSame("some\ninput", $dialog->ask($this->createStreamableInputInterfaceMock($response), $this->createOutputInterface(), $question));
522-
$this->assertSame(8, ftell($response));
522+
$this->assertSame(18, ftell($response));
523523
}
524524

525525
/**

0 commit comments

Comments
 (0)