Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca7b7b6

Browse filesBrowse files
Merge branch '4.3' into 4.4
* 4.3: Fix travis script minor fix for wrong case [HttpFoundation] Fix `getMaxFilesize` [Cache] fix warning on PHP 7.4 [Console] fix warning on PHP 7.4 Don't add value of (default/static) objects to the signature fix(yml): fix comment in milti line value Make sure trace_level is always defined Fix bindings and tagged_locator Recompile container when translations directory changes
2 parents d25448c + 3592d69 commit ca7b7b6
Copy full SHA for ca7b7b6

File tree

Expand file treeCollapse file tree

23 files changed

+76
-47
lines changed
Filter options
Expand file treeCollapse file tree

23 files changed

+76
-47
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ install:
190190
export SYMFONY_DEPRECATIONS_HELPER=weak &&
191191
cp composer.json composer.json.orig &&
192192
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
193-
php .github/build-packages.php HEAD^ $COMPONENTS &&
193+
php .github/build-packages.php HEAD^ $(find src/Symfony -mindepth 3 -type f -name composer.json -printf '%h\n') &&
194194
mv composer.json composer.json.phpunit &&
195195
mv composer.json.orig composer.json
196196
fi

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,12 +1143,12 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
11431143
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
11441144
$rootDir = $container->getParameter('kernel.root_dir');
11451145
foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) {
1146-
if (is_dir($dir = $bundle['path'].'/Resources/translations')) {
1146+
if ($container->fileExists($dir = $bundle['path'].'/Resources/translations')) {
11471147
$dirs[] = $dir;
11481148
} else {
11491149
$nonExistingDirs[] = $dir;
11501150
}
1151-
if (is_dir($dir = $rootDir.sprintf('/Resources/%s/translations', $name))) {
1151+
if ($container->fileExists($dir = $rootDir.sprintf('/Resources/%s/translations', $name))) {
11521152
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
11531153
$dirs[] = $dir;
11541154
} else {
@@ -1157,7 +1157,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
11571157
}
11581158

11591159
foreach ($config['paths'] as $dir) {
1160-
if (is_dir($dir)) {
1160+
if ($container->fileExists($dir)) {
11611161
$dirs[] = $transPaths[] = $dir;
11621162
} else {
11631163
throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory', $dir));
@@ -1172,13 +1172,13 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
11721172
$container->getDefinition('console.command.translation_update')->replaceArgument(6, $transPaths);
11731173
}
11741174

1175-
if (is_dir($defaultDir)) {
1175+
if ($container->fileExists($defaultDir)) {
11761176
$dirs[] = $defaultDir;
11771177
} else {
11781178
$nonExistingDirs[] = $defaultDir;
11791179
}
11801180

1181-
if (is_dir($dir = $rootDir.'/Resources/translations')) {
1181+
if ($container->fileExists($dir = $rootDir.'/Resources/translations')) {
11821182
if ($dir !== $defaultDir) {
11831183
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
11841184
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
-13Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
use Symfony\Component\Cache\Adapter\ProxyAdapter;
2727
use Symfony\Component\Cache\Adapter\RedisAdapter;
2828
use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
29-
use Symfony\Component\Config\Resource\DirectoryResource;
30-
use Symfony\Component\Config\Resource\FileExistenceResource;
3129
use Symfony\Component\DependencyInjection\ChildDefinition;
3230
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
3331
use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass;
@@ -847,17 +845,6 @@ function ($directory) {
847845
);
848846

849847
$this->assertNotEmpty($nonExistingDirectories, 'FrameworkBundle should pass non existing directories to Translator');
850-
851-
$resources = $container->getResources();
852-
foreach ($resources as $resource) {
853-
if ($resource instanceof DirectoryResource) {
854-
$this->assertNotContains('translations', $resource->getResource());
855-
}
856-
857-
if ($resource instanceof FileExistenceResource) {
858-
$this->assertNotContains('translations', $resource->getResource());
859-
}
860-
}
861848
}
862849

863850
/**

‎src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function __construct(string $namespace = '', int $defaultLifetime = 0)
4444
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
4545
}
4646
$this->createCacheItem = \Closure::bind(
47-
function ($key, $value, $isHit) use ($defaultLifetime) {
47+
static function ($key, $value, $isHit) use ($defaultLifetime) {
4848
$item = new CacheItem();
4949
$item->key = $key;
5050
$item->value = $v = $value;
@@ -67,7 +67,7 @@ function ($key, $value, $isHit) use ($defaultLifetime) {
6767
);
6868
$getId = \Closure::fromCallable([$this, 'getId']);
6969
$this->mergeByLifetime = \Closure::bind(
70-
function ($deferred, $namespace, &$expiredIds) use ($getId) {
70+
static function ($deferred, $namespace, &$expiredIds) use ($getId) {
7171
$byLifetime = [];
7272
$now = microtime(true);
7373
$expiredIds = [];

‎src/Symfony/Component/Cache/Adapter/ArrayAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(int $defaultLifetime = 0, bool $storeSerialized = tr
3535
{
3636
$this->storeSerialized = $storeSerialized;
3737
$this->createCacheItem = \Closure::bind(
38-
function ($key, $value, $isHit) use ($defaultLifetime) {
38+
static function ($key, $value, $isHit) use ($defaultLifetime) {
3939
$item = new CacheItem();
4040
$item->key = $key;
4141
$item->value = $value;

‎src/Symfony/Component/Cache/Adapter/ChainAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/ChainAdapter.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(array $adapters, int $defaultLifetime = 0)
6161
$this->adapterCount = \count($this->adapters);
6262

6363
$this->syncItem = \Closure::bind(
64-
function ($sourceItem, $item) use ($defaultLifetime) {
64+
static function ($sourceItem, $item) use ($defaultLifetime) {
6565
$item->value = $sourceItem->value;
6666
$item->expiry = $sourceItem->expiry;
6767
$item->isHit = $sourceItem->isHit;

‎src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(string $file, AdapterInterface $fallbackPool)
4444
$this->file = $file;
4545
$this->pool = $fallbackPool;
4646
$this->createCacheItem = \Closure::bind(
47-
function ($key, $value, $isHit) {
47+
static function ($key, $value, $isHit) {
4848
$item = new CacheItem();
4949
$item->key = $key;
5050
$item->value = $value;

‎src/Symfony/Component/Cache/Adapter/ProxyAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(CacheItemPoolInterface $pool, string $namespace = ''
4141
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
4242
$this->namespaceLen = \strlen($namespace);
4343
$this->createCacheItem = \Closure::bind(
44-
function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
44+
static function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
4545
$item = new CacheItem();
4646
$item->key = $key;
4747

@@ -77,7 +77,7 @@ function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
7777
/**
7878
* @param array $item A CacheItem cast to (array); accessing protected properties requires adding the "\0*\0" PHP prefix
7979
*/
80-
function (CacheItemInterface $innerItem, array $item) {
80+
static function (CacheItemInterface $innerItem, array $item) {
8181
// Tags are stored separately, no need to account for them when considering this item's newly set metadata
8282
if (isset(($metadata = $item["\0*\0newMetadata"])[CacheItem::METADATA_TAGS])) {
8383
unset($metadata[CacheItem::METADATA_TAGS]);

‎src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsP
4545
$this->tags = $tagsPool ?: $itemsPool;
4646
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
4747
$this->createCacheItem = \Closure::bind(
48-
function ($key, $value, CacheItem $protoItem) {
48+
static function ($key, $value, CacheItem $protoItem) {
4949
$item = new CacheItem();
5050
$item->key = $key;
5151
$item->value = $value;
@@ -59,7 +59,7 @@ function ($key, $value, CacheItem $protoItem) {
5959
CacheItem::class
6060
);
6161
$this->setCacheItemTags = \Closure::bind(
62-
function (CacheItem $item, $key, array &$itemTags) {
62+
static function (CacheItem $item, $key, array &$itemTags) {
6363
$item->isTaggable = true;
6464
if (!$item->isHit) {
6565
return $item;
@@ -80,7 +80,7 @@ function (CacheItem $item, $key, array &$itemTags) {
8080
CacheItem::class
8181
);
8282
$this->getTagsByKey = \Closure::bind(
83-
function ($deferred) {
83+
static function ($deferred) {
8484
$tagsByKey = [];
8585
foreach ($deferred as $key => $item) {
8686
$tagsByKey[$key] = $item->newMetadata[CacheItem::METADATA_TAGS] ?? [];
@@ -92,7 +92,7 @@ function ($deferred) {
9292
CacheItem::class
9393
);
9494
$this->invalidateTags = \Closure::bind(
95-
function (AdapterInterface $tagsAdapter, array $tags) {
95+
static function (AdapterInterface $tagsAdapter, array $tags) {
9696
foreach ($tags as $v) {
9797
$v->defaultLifetime = 0;
9898
$v->expiry = null;

‎src/Symfony/Component/Cache/Psr16Cache.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Psr16Cache.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(CacheItemPoolInterface $pool)
4242
}
4343
$cacheItemPrototype = &$this->cacheItemPrototype;
4444
$createCacheItem = \Closure::bind(
45-
function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
45+
static function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
4646
$item = clone $cacheItemPrototype;
4747
$item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
4848
$item->value = $value;

‎src/Symfony/Component/Cache/Traits/ContractsTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/ContractsTrait.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private function doGet(AdapterInterface $pool, string $key, callable $callback,
5858
static $setMetadata;
5959

6060
$setMetadata = $setMetadata ?? \Closure::bind(
61-
function (CacheItem $item, float $startTime, ?array &$metadata) {
61+
static function (CacheItem $item, float $startTime, ?array &$metadata) {
6262
if ($item->expiry > $endTime = microtime(true)) {
6363
$item->newMetadata[CacheItem::METADATA_EXPIRY] = $metadata[CacheItem::METADATA_EXPIRY] = $item->expiry;
6464
$item->newMetadata[CacheItem::METADATA_CTIME] = $metadata[CacheItem::METADATA_CTIME] = 1000 * (int) ($endTime - $startTime);

‎src/Symfony/Component/Config/Resource/ReflectionClassResource.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Resource/ReflectionClassResource.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private function generateSignature(\ReflectionClass $class)
136136

137137
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
138138
yield $p->getDocComment().$p;
139-
yield print_r(isset($defaults[$p->name]) ? $defaults[$p->name] : null, true);
139+
yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
140140
}
141141
}
142142

‎src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ public function testServiceSubscriber()
185185
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceSubscriber::class));
186186
$this->assertTrue($res->isFresh(0));
187187
}
188+
189+
public function testIgnoresObjectsInSignature()
190+
{
191+
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceWithStaticProperty::class));
192+
$this->assertTrue($res->isFresh(0));
193+
194+
TestServiceWithStaticProperty::$initializedObject = new TestServiceWithStaticProperty();
195+
$this->assertTrue($res->isFresh(0));
196+
}
188197
}
189198

190199
interface DummyInterface
@@ -224,3 +233,8 @@ public static function getSubscribedServices()
224233
return self::$subscribedServices;
225234
}
226235
}
236+
237+
class TestServiceWithStaticProperty
238+
{
239+
public static $initializedObject;
240+
}

‎src/Symfony/Component/Console/Input/ArrayInput.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Input/ArrayInput.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected function parse()
132132
}
133133
if (0 === strpos($key, '--')) {
134134
$this->addLongOption(substr($key, 2), $value);
135-
} elseif ('-' === $key[0]) {
135+
} elseif (0 === strpos($key, '-')) {
136136
$this->addShortOption(substr($key, 1), $value);
137137
} else {
138138
$this->addArgument($key, $value);

‎src/Symfony/Component/Debug/Exception/SilencedErrorContext.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Exception/SilencedErrorContext.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function getTrace()
5858
return $this->trace;
5959
}
6060

61-
public function JsonSerialize()
61+
public function jsonSerialize()
6262
{
6363
return [
6464
'severity' => $this->severity,

‎src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ public function __construct()
5151
$this->optimizationPasses = [[
5252
new ValidateEnvPlaceholdersPass(),
5353
new ResolveChildDefinitionsPass(),
54-
new ServiceLocatorTagPass(),
5554
new RegisterServiceSubscribersPass(),
5655
new DecoratorServicePass(),
5756
new ResolveParameterPlaceHoldersPass(false),
5857
new ResolveFactoryClassPass(),
59-
new CheckDefinitionValidityPass(),
6058
new ResolveNamedArgumentsPass(),
6159
new AutowireRequiredMethodsPass(),
6260
new ResolveBindingsPass(),
61+
new ServiceLocatorTagPass(),
62+
new CheckDefinitionValidityPass(),
6363
new AutowirePass(false),
6464
new ResolveTaggedIteratorArgumentPass(),
6565
new ResolveServiceSubscribersPass(),

‎src/Symfony/Component/HttpFoundation/File/UploadedFile.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/File/UploadedFile.php
+18-5Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,26 @@ public function move($directory, $name = null)
243243
*/
244244
public static function getMaxFilesize()
245245
{
246-
$iniMax = strtolower(ini_get('upload_max_filesize'));
246+
$sizePostMax = self::parseFilesize(ini_get('post_max_size'));
247+
$sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize'));
247248

248-
if ('' === $iniMax) {
249-
return PHP_INT_MAX;
249+
return min([$sizePostMax, $sizeUploadMax]);
250+
}
251+
252+
/**
253+
* Returns the given size from an ini value in bytes.
254+
*
255+
* @return int The given size in bytes
256+
*/
257+
private static function parseFilesize($size)
258+
{
259+
if ('' === $size) {
260+
return 0;
250261
}
251262

252-
$max = ltrim($iniMax, '+');
263+
$size = strtolower($size);
264+
265+
$max = ltrim($size, '+');
253266
if (0 === strpos($max, '0x')) {
254267
$max = \intval($max, 16);
255268
} elseif (0 === strpos($max, '0')) {
@@ -258,7 +271,7 @@ public static function getMaxFilesize()
258271
$max = (int) $max;
259272
}
260273

261-
switch (substr($iniMax, -1)) {
274+
switch (substr($size, -1)) {
262275
case 't': $max *= 1024;
263276
// no break
264277
case 'g': $max *= 1024;

‎src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected function createSubRequest($uri, Request $request)
122122
static $setSession;
123123

124124
if (null === $setSession) {
125-
$setSession = \Closure::bind(function ($subRequest, $request) { $subRequest->session = $request->session; }, null, Request::class);
125+
$setSession = \Closure::bind(static function ($subRequest, $request) { $subRequest->session = $request->session; }, null, Request::class);
126126
}
127127
$setSession($subRequest, $request);
128128

‎src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public function __construct(HttpKernelInterface $kernel, StoreInterface $store,
9898
'trace_header' => 'X-Symfony-Cache',
9999
], $options);
100100

101-
if (!isset($options['trace_level']) && $this->options['debug']) {
102-
$this->options['trace_level'] = 'full';
101+
if (!isset($options['trace_level'])) {
102+
$this->options['trace_level'] = $this->options['debug'] ? 'full' : 'none';
103103
}
104104
}
105105

‎src/Symfony/Component/Routing/Loader/PhpFileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/PhpFileLoader.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function load($file, $type = null)
4040

4141
// the closure forbids access to the private scope in the included file
4242
$loader = $this;
43-
$load = \Closure::bind(function ($file) use ($loader) {
43+
$load = \Closure::bind(static function ($file) use ($loader) {
4444
return include $file;
4545
}, null, ProtectedPhpFileLoader::class);
4646

‎src/Symfony/Component/Security/Http/HttpUtils.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/HttpUtils.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function createRequest(Request $request, $path)
8787
static $setSession;
8888

8989
if (null === $setSession) {
90-
$setSession = \Closure::bind(function ($newRequest, $request) { $newRequest->session = $request->session; }, null, Request::class);
90+
$setSession = \Closure::bind(static function ($newRequest, $request) { $newRequest->session = $request->session; }, null, Request::class);
9191
}
9292
$setSession($newRequest, $request);
9393

‎src/Symfony/Component/Yaml/Parser.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Parser.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ private function doParse(string $value, int $flags)
386386
$value = '';
387387

388388
foreach ($this->lines as $line) {
389+
if ('' !== ltrim($line) && '#' === ltrim($line)[0]) {
390+
continue;
391+
}
389392
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
390393
if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
391394
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);

‎src/Symfony/Component/Yaml/Tests/ParserTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/ParserTest.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,6 +2152,18 @@ public function indentedMappingData()
21522152

21532153
return $tests;
21542154
}
2155+
2156+
public function testMultiLineComment()
2157+
{
2158+
$yaml = <<<YAML
2159+
parameters:
2160+
abc
2161+
2162+
# Comment
2163+
YAML;
2164+
2165+
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
2166+
}
21552167
}
21562168

21572169
class B

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.