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
This commit is contained in:
commit
ca7b7b629e
@ -190,7 +190,7 @@ install:
|
|||||||
export SYMFONY_DEPRECATIONS_HELPER=weak &&
|
export SYMFONY_DEPRECATIONS_HELPER=weak &&
|
||||||
cp composer.json composer.json.orig &&
|
cp composer.json composer.json.orig &&
|
||||||
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
|
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
|
||||||
php .github/build-packages.php HEAD^ $COMPONENTS &&
|
php .github/build-packages.php HEAD^ $(find src/Symfony -mindepth 3 -type f -name composer.json -printf '%h\n') &&
|
||||||
mv composer.json composer.json.phpunit &&
|
mv composer.json composer.json.phpunit &&
|
||||||
mv composer.json.orig composer.json
|
mv composer.json.orig composer.json
|
||||||
fi
|
fi
|
||||||
|
@ -1143,12 +1143,12 @@ class FrameworkExtension extends Extension
|
|||||||
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
|
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
|
||||||
$rootDir = $container->getParameter('kernel.root_dir');
|
$rootDir = $container->getParameter('kernel.root_dir');
|
||||||
foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) {
|
foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) {
|
||||||
if (is_dir($dir = $bundle['path'].'/Resources/translations')) {
|
if ($container->fileExists($dir = $bundle['path'].'/Resources/translations')) {
|
||||||
$dirs[] = $dir;
|
$dirs[] = $dir;
|
||||||
} else {
|
} else {
|
||||||
$nonExistingDirs[] = $dir;
|
$nonExistingDirs[] = $dir;
|
||||||
}
|
}
|
||||||
if (is_dir($dir = $rootDir.sprintf('/Resources/%s/translations', $name))) {
|
if ($container->fileExists($dir = $rootDir.sprintf('/Resources/%s/translations', $name))) {
|
||||||
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
|
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
|
||||||
$dirs[] = $dir;
|
$dirs[] = $dir;
|
||||||
} else {
|
} else {
|
||||||
@ -1157,7 +1157,7 @@ class FrameworkExtension extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($config['paths'] as $dir) {
|
foreach ($config['paths'] as $dir) {
|
||||||
if (is_dir($dir)) {
|
if ($container->fileExists($dir)) {
|
||||||
$dirs[] = $transPaths[] = $dir;
|
$dirs[] = $transPaths[] = $dir;
|
||||||
} else {
|
} else {
|
||||||
throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory', $dir));
|
throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory', $dir));
|
||||||
@ -1172,13 +1172,13 @@ class FrameworkExtension extends Extension
|
|||||||
$container->getDefinition('console.command.translation_update')->replaceArgument(6, $transPaths);
|
$container->getDefinition('console.command.translation_update')->replaceArgument(6, $transPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($defaultDir)) {
|
if ($container->fileExists($defaultDir)) {
|
||||||
$dirs[] = $defaultDir;
|
$dirs[] = $defaultDir;
|
||||||
} else {
|
} else {
|
||||||
$nonExistingDirs[] = $defaultDir;
|
$nonExistingDirs[] = $defaultDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($dir = $rootDir.'/Resources/translations')) {
|
if ($container->fileExists($dir = $rootDir.'/Resources/translations')) {
|
||||||
if ($dir !== $defaultDir) {
|
if ($dir !== $defaultDir) {
|
||||||
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
|
@trigger_error(sprintf('Translations directory "%s" is deprecated since Symfony 4.2, use "%s" instead.', $dir, $defaultDir), E_USER_DEPRECATED);
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,6 @@ use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
|||||||
use Symfony\Component\Cache\Adapter\ProxyAdapter;
|
use Symfony\Component\Cache\Adapter\ProxyAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\RedisAdapter;
|
use Symfony\Component\Cache\Adapter\RedisAdapter;
|
||||||
use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
|
use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
|
||||||
use Symfony\Component\Config\Resource\DirectoryResource;
|
|
||||||
use Symfony\Component\Config\Resource\FileExistenceResource;
|
|
||||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass;
|
use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass;
|
||||||
@ -847,17 +845,6 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->assertNotEmpty($nonExistingDirectories, 'FrameworkBundle should pass non existing directories to Translator');
|
$this->assertNotEmpty($nonExistingDirectories, 'FrameworkBundle should pass non existing directories to Translator');
|
||||||
|
|
||||||
$resources = $container->getResources();
|
|
||||||
foreach ($resources as $resource) {
|
|
||||||
if ($resource instanceof DirectoryResource) {
|
|
||||||
$this->assertNotContains('translations', $resource->getResource());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($resource instanceof FileExistenceResource) {
|
|
||||||
$this->assertNotContains('translations', $resource->getResource());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
|
|||||||
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, \strlen($namespace), $namespace));
|
||||||
}
|
}
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $isHit) use ($defaultLifetime) {
|
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $v = $value;
|
$item->value = $v = $value;
|
||||||
@ -67,7 +67,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg
|
|||||||
);
|
);
|
||||||
$getId = \Closure::fromCallable([$this, 'getId']);
|
$getId = \Closure::fromCallable([$this, 'getId']);
|
||||||
$this->mergeByLifetime = \Closure::bind(
|
$this->mergeByLifetime = \Closure::bind(
|
||||||
function ($deferred, $namespace, &$expiredIds) use ($getId) {
|
static function ($deferred, $namespace, &$expiredIds) use ($getId) {
|
||||||
$byLifetime = [];
|
$byLifetime = [];
|
||||||
$now = microtime(true);
|
$now = microtime(true);
|
||||||
$expiredIds = [];
|
$expiredIds = [];
|
||||||
|
@ -35,7 +35,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
|
|||||||
{
|
{
|
||||||
$this->storeSerialized = $storeSerialized;
|
$this->storeSerialized = $storeSerialized;
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $isHit) use ($defaultLifetime) {
|
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
|
@ -61,7 +61,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
$this->adapterCount = \count($this->adapters);
|
$this->adapterCount = \count($this->adapters);
|
||||||
|
|
||||||
$this->syncItem = \Closure::bind(
|
$this->syncItem = \Closure::bind(
|
||||||
function ($sourceItem, $item) use ($defaultLifetime) {
|
static function ($sourceItem, $item) use ($defaultLifetime) {
|
||||||
$item->value = $sourceItem->value;
|
$item->value = $sourceItem->value;
|
||||||
$item->expiry = $sourceItem->expiry;
|
$item->expiry = $sourceItem->expiry;
|
||||||
$item->isHit = $sourceItem->isHit;
|
$item->isHit = $sourceItem->isHit;
|
||||||
|
@ -44,7 +44,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte
|
|||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
$this->pool = $fallbackPool;
|
$this->pool = $fallbackPool;
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $isHit) {
|
static function ($key, $value, $isHit) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
|
@ -41,7 +41,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
|
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace);
|
||||||
$this->namespaceLen = \strlen($namespace);
|
$this->namespaceLen = \strlen($namespace);
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
|
static function ($key, $innerItem) use ($defaultLifetime, $poolHash) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
|||||||
/**
|
/**
|
||||||
* @param array $item A CacheItem cast to (array); accessing protected properties requires adding the "\0*\0" PHP prefix
|
* @param array $item A CacheItem cast to (array); accessing protected properties requires adding the "\0*\0" PHP prefix
|
||||||
*/
|
*/
|
||||||
function (CacheItemInterface $innerItem, array $item) {
|
static function (CacheItemInterface $innerItem, array $item) {
|
||||||
// Tags are stored separately, no need to account for them when considering this item's newly set metadata
|
// Tags are stored separately, no need to account for them when considering this item's newly set metadata
|
||||||
if (isset(($metadata = $item["\0*\0newMetadata"])[CacheItem::METADATA_TAGS])) {
|
if (isset(($metadata = $item["\0*\0newMetadata"])[CacheItem::METADATA_TAGS])) {
|
||||||
unset($metadata[CacheItem::METADATA_TAGS]);
|
unset($metadata[CacheItem::METADATA_TAGS]);
|
||||||
|
@ -45,7 +45,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
|
|||||||
$this->tags = $tagsPool ?: $itemsPool;
|
$this->tags = $tagsPool ?: $itemsPool;
|
||||||
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
|
$this->knownTagVersionsTtl = $knownTagVersionsTtl;
|
||||||
$this->createCacheItem = \Closure::bind(
|
$this->createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, CacheItem $protoItem) {
|
static function ($key, $value, CacheItem $protoItem) {
|
||||||
$item = new CacheItem();
|
$item = new CacheItem();
|
||||||
$item->key = $key;
|
$item->key = $key;
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
@ -59,7 +59,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
|
|||||||
CacheItem::class
|
CacheItem::class
|
||||||
);
|
);
|
||||||
$this->setCacheItemTags = \Closure::bind(
|
$this->setCacheItemTags = \Closure::bind(
|
||||||
function (CacheItem $item, $key, array &$itemTags) {
|
static function (CacheItem $item, $key, array &$itemTags) {
|
||||||
$item->isTaggable = true;
|
$item->isTaggable = true;
|
||||||
if (!$item->isHit) {
|
if (!$item->isHit) {
|
||||||
return $item;
|
return $item;
|
||||||
@ -80,7 +80,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
|
|||||||
CacheItem::class
|
CacheItem::class
|
||||||
);
|
);
|
||||||
$this->getTagsByKey = \Closure::bind(
|
$this->getTagsByKey = \Closure::bind(
|
||||||
function ($deferred) {
|
static function ($deferred) {
|
||||||
$tagsByKey = [];
|
$tagsByKey = [];
|
||||||
foreach ($deferred as $key => $item) {
|
foreach ($deferred as $key => $item) {
|
||||||
$tagsByKey[$key] = $item->newMetadata[CacheItem::METADATA_TAGS] ?? [];
|
$tagsByKey[$key] = $item->newMetadata[CacheItem::METADATA_TAGS] ?? [];
|
||||||
@ -92,7 +92,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
|
|||||||
CacheItem::class
|
CacheItem::class
|
||||||
);
|
);
|
||||||
$this->invalidateTags = \Closure::bind(
|
$this->invalidateTags = \Closure::bind(
|
||||||
function (AdapterInterface $tagsAdapter, array $tags) {
|
static function (AdapterInterface $tagsAdapter, array $tags) {
|
||||||
foreach ($tags as $v) {
|
foreach ($tags as $v) {
|
||||||
$v->defaultLifetime = 0;
|
$v->defaultLifetime = 0;
|
||||||
$v->expiry = null;
|
$v->expiry = null;
|
||||||
|
@ -42,7 +42,7 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf
|
|||||||
}
|
}
|
||||||
$cacheItemPrototype = &$this->cacheItemPrototype;
|
$cacheItemPrototype = &$this->cacheItemPrototype;
|
||||||
$createCacheItem = \Closure::bind(
|
$createCacheItem = \Closure::bind(
|
||||||
function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
|
static function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
|
||||||
$item = clone $cacheItemPrototype;
|
$item = clone $cacheItemPrototype;
|
||||||
$item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
|
$item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
|
||||||
$item->value = $value;
|
$item->value = $value;
|
||||||
|
@ -58,7 +58,7 @@ trait ContractsTrait
|
|||||||
static $setMetadata;
|
static $setMetadata;
|
||||||
|
|
||||||
$setMetadata = $setMetadata ?? \Closure::bind(
|
$setMetadata = $setMetadata ?? \Closure::bind(
|
||||||
function (CacheItem $item, float $startTime, ?array &$metadata) {
|
static function (CacheItem $item, float $startTime, ?array &$metadata) {
|
||||||
if ($item->expiry > $endTime = microtime(true)) {
|
if ($item->expiry > $endTime = microtime(true)) {
|
||||||
$item->newMetadata[CacheItem::METADATA_EXPIRY] = $metadata[CacheItem::METADATA_EXPIRY] = $item->expiry;
|
$item->newMetadata[CacheItem::METADATA_EXPIRY] = $metadata[CacheItem::METADATA_EXPIRY] = $item->expiry;
|
||||||
$item->newMetadata[CacheItem::METADATA_CTIME] = $metadata[CacheItem::METADATA_CTIME] = 1000 * (int) ($endTime - $startTime);
|
$item->newMetadata[CacheItem::METADATA_CTIME] = $metadata[CacheItem::METADATA_CTIME] = 1000 * (int) ($endTime - $startTime);
|
||||||
|
@ -136,7 +136,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
|||||||
|
|
||||||
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
|
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
|
||||||
yield $p->getDocComment().$p;
|
yield $p->getDocComment().$p;
|
||||||
yield print_r(isset($defaults[$p->name]) ? $defaults[$p->name] : null, true);
|
yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +185,15 @@ EOPHP;
|
|||||||
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceSubscriber::class));
|
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceSubscriber::class));
|
||||||
$this->assertTrue($res->isFresh(0));
|
$this->assertTrue($res->isFresh(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testIgnoresObjectsInSignature()
|
||||||
|
{
|
||||||
|
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceWithStaticProperty::class));
|
||||||
|
$this->assertTrue($res->isFresh(0));
|
||||||
|
|
||||||
|
TestServiceWithStaticProperty::$initializedObject = new TestServiceWithStaticProperty();
|
||||||
|
$this->assertTrue($res->isFresh(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DummyInterface
|
interface DummyInterface
|
||||||
@ -224,3 +233,8 @@ class TestServiceSubscriber implements ServiceSubscriberInterface
|
|||||||
return self::$subscribedServices;
|
return self::$subscribedServices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TestServiceWithStaticProperty
|
||||||
|
{
|
||||||
|
public static $initializedObject;
|
||||||
|
}
|
||||||
|
@ -132,7 +132,7 @@ class ArrayInput extends Input
|
|||||||
}
|
}
|
||||||
if (0 === strpos($key, '--')) {
|
if (0 === strpos($key, '--')) {
|
||||||
$this->addLongOption(substr($key, 2), $value);
|
$this->addLongOption(substr($key, 2), $value);
|
||||||
} elseif ('-' === $key[0]) {
|
} elseif (0 === strpos($key, '-')) {
|
||||||
$this->addShortOption(substr($key, 1), $value);
|
$this->addShortOption(substr($key, 1), $value);
|
||||||
} else {
|
} else {
|
||||||
$this->addArgument($key, $value);
|
$this->addArgument($key, $value);
|
||||||
|
@ -58,7 +58,7 @@ class SilencedErrorContext implements \JsonSerializable
|
|||||||
return $this->trace;
|
return $this->trace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function JsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'severity' => $this->severity,
|
'severity' => $this->severity,
|
||||||
|
@ -51,15 +51,15 @@ class PassConfig
|
|||||||
$this->optimizationPasses = [[
|
$this->optimizationPasses = [[
|
||||||
new ValidateEnvPlaceholdersPass(),
|
new ValidateEnvPlaceholdersPass(),
|
||||||
new ResolveChildDefinitionsPass(),
|
new ResolveChildDefinitionsPass(),
|
||||||
new ServiceLocatorTagPass(),
|
|
||||||
new RegisterServiceSubscribersPass(),
|
new RegisterServiceSubscribersPass(),
|
||||||
new DecoratorServicePass(),
|
new DecoratorServicePass(),
|
||||||
new ResolveParameterPlaceHoldersPass(false),
|
new ResolveParameterPlaceHoldersPass(false),
|
||||||
new ResolveFactoryClassPass(),
|
new ResolveFactoryClassPass(),
|
||||||
new CheckDefinitionValidityPass(),
|
|
||||||
new ResolveNamedArgumentsPass(),
|
new ResolveNamedArgumentsPass(),
|
||||||
new AutowireRequiredMethodsPass(),
|
new AutowireRequiredMethodsPass(),
|
||||||
new ResolveBindingsPass(),
|
new ResolveBindingsPass(),
|
||||||
|
new ServiceLocatorTagPass(),
|
||||||
|
new CheckDefinitionValidityPass(),
|
||||||
new AutowirePass(false),
|
new AutowirePass(false),
|
||||||
new ResolveTaggedIteratorArgumentPass(),
|
new ResolveTaggedIteratorArgumentPass(),
|
||||||
new ResolveServiceSubscribersPass(),
|
new ResolveServiceSubscribersPass(),
|
||||||
|
@ -243,13 +243,26 @@ class UploadedFile extends File
|
|||||||
*/
|
*/
|
||||||
public static function getMaxFilesize()
|
public static function getMaxFilesize()
|
||||||
{
|
{
|
||||||
$iniMax = strtolower(ini_get('upload_max_filesize'));
|
$sizePostMax = self::parseFilesize(ini_get('post_max_size'));
|
||||||
|
$sizeUploadMax = self::parseFilesize(ini_get('upload_max_filesize'));
|
||||||
|
|
||||||
if ('' === $iniMax) {
|
return min([$sizePostMax, $sizeUploadMax]);
|
||||||
return PHP_INT_MAX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$max = ltrim($iniMax, '+');
|
/**
|
||||||
|
* Returns the given size from an ini value in bytes.
|
||||||
|
*
|
||||||
|
* @return int The given size in bytes
|
||||||
|
*/
|
||||||
|
private static function parseFilesize($size)
|
||||||
|
{
|
||||||
|
if ('' === $size) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$size = strtolower($size);
|
||||||
|
|
||||||
|
$max = ltrim($size, '+');
|
||||||
if (0 === strpos($max, '0x')) {
|
if (0 === strpos($max, '0x')) {
|
||||||
$max = \intval($max, 16);
|
$max = \intval($max, 16);
|
||||||
} elseif (0 === strpos($max, '0')) {
|
} elseif (0 === strpos($max, '0')) {
|
||||||
@ -258,7 +271,7 @@ class UploadedFile extends File
|
|||||||
$max = (int) $max;
|
$max = (int) $max;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (substr($iniMax, -1)) {
|
switch (substr($size, -1)) {
|
||||||
case 't': $max *= 1024;
|
case 't': $max *= 1024;
|
||||||
// no break
|
// no break
|
||||||
case 'g': $max *= 1024;
|
case 'g': $max *= 1024;
|
||||||
|
@ -122,7 +122,7 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer
|
|||||||
static $setSession;
|
static $setSession;
|
||||||
|
|
||||||
if (null === $setSession) {
|
if (null === $setSession) {
|
||||||
$setSession = \Closure::bind(function ($subRequest, $request) { $subRequest->session = $request->session; }, null, Request::class);
|
$setSession = \Closure::bind(static function ($subRequest, $request) { $subRequest->session = $request->session; }, null, Request::class);
|
||||||
}
|
}
|
||||||
$setSession($subRequest, $request);
|
$setSession($subRequest, $request);
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||||||
'trace_header' => 'X-Symfony-Cache',
|
'trace_header' => 'X-Symfony-Cache',
|
||||||
], $options);
|
], $options);
|
||||||
|
|
||||||
if (!isset($options['trace_level']) && $this->options['debug']) {
|
if (!isset($options['trace_level'])) {
|
||||||
$this->options['trace_level'] = 'full';
|
$this->options['trace_level'] = $this->options['debug'] ? 'full' : 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class PhpFileLoader extends FileLoader
|
|||||||
|
|
||||||
// the closure forbids access to the private scope in the included file
|
// the closure forbids access to the private scope in the included file
|
||||||
$loader = $this;
|
$loader = $this;
|
||||||
$load = \Closure::bind(function ($file) use ($loader) {
|
$load = \Closure::bind(static function ($file) use ($loader) {
|
||||||
return include $file;
|
return include $file;
|
||||||
}, null, ProtectedPhpFileLoader::class);
|
}, null, ProtectedPhpFileLoader::class);
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class HttpUtils
|
|||||||
static $setSession;
|
static $setSession;
|
||||||
|
|
||||||
if (null === $setSession) {
|
if (null === $setSession) {
|
||||||
$setSession = \Closure::bind(function ($newRequest, $request) { $newRequest->session = $request->session; }, null, Request::class);
|
$setSession = \Closure::bind(static function ($newRequest, $request) { $newRequest->session = $request->session; }, null, Request::class);
|
||||||
}
|
}
|
||||||
$setSession($newRequest, $request);
|
$setSession($newRequest, $request);
|
||||||
|
|
||||||
|
@ -386,6 +386,9 @@ class Parser
|
|||||||
$value = '';
|
$value = '';
|
||||||
|
|
||||||
foreach ($this->lines as $line) {
|
foreach ($this->lines as $line) {
|
||||||
|
if ('' !== ltrim($line) && '#' === ltrim($line)[0]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
|
// If the indentation is not consistent at offset 0, it is to be considered as a ParseError
|
||||||
if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
|
if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) {
|
||||||
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
|
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
|
||||||
|
@ -2152,6 +2152,18 @@ YAML;
|
|||||||
|
|
||||||
return $tests;
|
return $tests;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMultiLineComment()
|
||||||
|
{
|
||||||
|
$yaml = <<<YAML
|
||||||
|
parameters:
|
||||||
|
abc
|
||||||
|
|
||||||
|
# Comment
|
||||||
|
YAML;
|
||||||
|
|
||||||
|
$this->assertSame(['parameters' => 'abc'], $this->parser->parse($yaml));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B
|
class B
|
||||||
|
Reference in New Issue
Block a user