Skip to content

Commit 762ee56

Browse files
Merge branch '5.4' into 6.4
* 5.4: [Process] minor fix [Process] Fix finding executables independently of open_basedir [HttpKernel] Skip logging uncaught exceptions in ErrorHandler, assume $kernel->terminateWithException() will do it parse empty sequence elements as null
2 parents be37e7f + 7025b96 commit 762ee56

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Inline.php

+8
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,18 @@ private static function parseSequence(string $sequence, int $flags, int &$i = 0,
353353
++$i;
354354

355355
// [foo, bar, ...]
356+
$lastToken = null;
356357
while ($i < $len) {
357358
if (']' === $sequence[$i]) {
358359
return $output;
359360
}
360361
if (',' === $sequence[$i] || ' ' === $sequence[$i]) {
362+
if (',' === $sequence[$i] && (null === $lastToken || 'separator' === $lastToken)) {
363+
$output[] = null;
364+
} elseif (',' === $sequence[$i]) {
365+
$lastToken = 'separator';
366+
}
367+
361368
++$i;
362369

363370
continue;
@@ -401,6 +408,7 @@ private static function parseSequence(string $sequence, int $flags, int &$i = 0,
401408

402409
$output[] = $value;
403410

411+
$lastToken = 'value';
404412
++$i;
405413
}
406414

Tests/InlineTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -1128,4 +1128,11 @@ public function testParseQuotedReferenceLikeStringsInSequence()
11281128

11291129
$this->assertSame(['&foo', '&bar', '&baz'], Inline::parse($yaml));
11301130
}
1131+
1132+
public function testParseSequenceWithEmptyElement()
1133+
{
1134+
$this->assertSame(['foo', null, 'bar'], Inline::parse('[foo, , bar]'));
1135+
$this->assertSame([null, 'foo', 'bar'], Inline::parse('[, foo, bar]'));
1136+
$this->assertSame(['foo', 'bar'], Inline::parse('[foo, bar, ]'));
1137+
}
11311138
}

0 commit comments

Comments
 (0)