Merge branch '2.7' into 2.8
* 2.7: [Finder] Partially revert #17134 to fix a regression [HttpKernel] Fix mem usage when stripping the prod container exception when registering bags for started sessions Conflicts: src/Symfony/Component/Validator/composer.json
This commit is contained in:
commit
2205eac37c
@ -26,6 +26,7 @@ use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper;
|
|||||||
use Symfony\Component\DependencyInjection\ExpressionLanguage;
|
use Symfony\Component\DependencyInjection\ExpressionLanguage;
|
||||||
use Symfony\Component\ExpressionLanguage\Expression;
|
use Symfony\Component\ExpressionLanguage\Expression;
|
||||||
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
|
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
|
||||||
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PhpDumper dumps a service container as a PHP class.
|
* PhpDumper dumps a service container as a PHP class.
|
||||||
@ -57,6 +58,7 @@ class PhpDumper extends Dumper
|
|||||||
private $expressionLanguage;
|
private $expressionLanguage;
|
||||||
private $targetDirRegex;
|
private $targetDirRegex;
|
||||||
private $targetDirMaxMatches;
|
private $targetDirMaxMatches;
|
||||||
|
private $docStar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ExpressionFunctionProviderInterface[]
|
* @var ExpressionFunctionProviderInterface[]
|
||||||
@ -108,7 +110,9 @@ class PhpDumper extends Dumper
|
|||||||
'class' => 'ProjectServiceContainer',
|
'class' => 'ProjectServiceContainer',
|
||||||
'base_class' => 'Container',
|
'base_class' => 'Container',
|
||||||
'namespace' => '',
|
'namespace' => '',
|
||||||
|
'debug' => true,
|
||||||
), $options);
|
), $options);
|
||||||
|
$this->docStar = $options['debug'] ? '*' : '';
|
||||||
|
|
||||||
if (!empty($options['file']) && is_dir($dir = dirname($options['file']))) {
|
if (!empty($options['file']) && is_dir($dir = dirname($options['file']))) {
|
||||||
// Build a regexp where the first root dirs are mandatory,
|
// Build a regexp where the first root dirs are mandatory,
|
||||||
@ -233,9 +237,15 @@ class PhpDumper extends Dumper
|
|||||||
array($this->getProxyDumper(), 'isProxyCandidate')
|
array($this->getProxyDumper(), 'isProxyCandidate')
|
||||||
);
|
);
|
||||||
$code = '';
|
$code = '';
|
||||||
|
$strip = '' === $this->docStar && method_exists('Symfony\Component\HttpKernel\Kernel', 'stripComments');
|
||||||
|
|
||||||
foreach ($definitions as $definition) {
|
foreach ($definitions as $definition) {
|
||||||
$code .= "\n".$this->getProxyDumper()->getProxyCode($definition);
|
$proxyCode = "\n".$this->getProxyDumper()->getProxyCode($definition);
|
||||||
|
if ($strip) {
|
||||||
|
$proxyCode = "<?php\n".$proxyCode;
|
||||||
|
$proxyCode = substr(Kernel::stripComments($proxyCode), 5);
|
||||||
|
}
|
||||||
|
$code .= $proxyCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $code;
|
return $code;
|
||||||
@ -637,7 +647,7 @@ EOF;
|
|||||||
$visibility = $isProxyCandidate ? 'public' : 'protected';
|
$visibility = $isProxyCandidate ? 'public' : 'protected';
|
||||||
$code = <<<EOF
|
$code = <<<EOF
|
||||||
|
|
||||||
/**
|
/*{$this->docStar}
|
||||||
* Gets the '$id' service.$doc
|
* Gets the '$id' service.$doc
|
||||||
*$lazyInitializationDoc
|
*$lazyInitializationDoc
|
||||||
* $return
|
* $return
|
||||||
@ -757,7 +767,7 @@ EOF;
|
|||||||
|
|
||||||
return <<<EOF
|
return <<<EOF
|
||||||
|
|
||||||
/**
|
/*{$this->docStar}
|
||||||
* Updates the '$id' service.
|
* Updates the '$id' service.
|
||||||
*/
|
*/
|
||||||
protected function synchronize{$this->camelize($id)}Service()
|
protected function synchronize{$this->camelize($id)}Service()
|
||||||
@ -849,7 +859,7 @@ use Symfony\Component\DependencyInjection\Exception\LogicException;
|
|||||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||||
$bagClass
|
$bagClass
|
||||||
|
|
||||||
/**
|
/*{$this->docStar}
|
||||||
* $class.
|
* $class.
|
||||||
*
|
*
|
||||||
* This class has been auto-generated
|
* This class has been auto-generated
|
||||||
@ -875,7 +885,7 @@ EOF;
|
|||||||
|
|
||||||
$code = <<<EOF
|
$code = <<<EOF
|
||||||
|
|
||||||
/**
|
/*{$this->docStar}
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -912,7 +922,7 @@ EOF;
|
|||||||
|
|
||||||
$code = <<<EOF
|
$code = <<<EOF
|
||||||
|
|
||||||
/**
|
/*{$this->docStar}
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -959,7 +969,7 @@ EOF;
|
|||||||
{
|
{
|
||||||
return <<<EOF
|
return <<<EOF
|
||||||
|
|
||||||
/**
|
/*{$this->docStar}
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function compile()
|
public function compile()
|
||||||
@ -1080,11 +1090,14 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
|
if ('' === $this->docStar) {
|
||||||
|
$code = str_replace('/**', '/*', $code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$code .= <<<EOF
|
$code .= <<<EOF
|
||||||
|
|
||||||
/**
|
/*{$this->docStar}
|
||||||
* Gets the default parameters.
|
* Gets the default parameters.
|
||||||
*
|
*
|
||||||
* @return array An array of the default parameters
|
* @return array An array of the default parameters
|
||||||
|
@ -39,11 +39,18 @@ abstract class FilterIterator extends \FilterIterator
|
|||||||
while ($iterator instanceof \OuterIterator) {
|
while ($iterator instanceof \OuterIterator) {
|
||||||
$innerIterator = $iterator->getInnerIterator();
|
$innerIterator = $iterator->getInnerIterator();
|
||||||
|
|
||||||
if ($innerIterator instanceof \FilesystemIterator) {
|
if ($innerIterator instanceof RecursiveDirectoryIterator) {
|
||||||
|
// this condition is necessary for iterators to work properly with non-local filesystems like ftp
|
||||||
|
if ($innerIterator->isRewindable()) {
|
||||||
|
$innerIterator->next();
|
||||||
|
$innerIterator->rewind();
|
||||||
|
}
|
||||||
|
} elseif ($innerIterator instanceof \FilesystemIterator) {
|
||||||
$innerIterator->next();
|
$innerIterator->next();
|
||||||
$innerIterator->rewind();
|
$innerIterator->rewind();
|
||||||
}
|
}
|
||||||
$iterator = $iterator->getInnerIterator();
|
|
||||||
|
$iterator = $innerIterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::rewind();
|
parent::rewind();
|
||||||
|
@ -256,6 +256,10 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
*/
|
*/
|
||||||
public function registerBag(SessionBagInterface $bag)
|
public function registerBag(SessionBagInterface $bag)
|
||||||
{
|
{
|
||||||
|
if ($this->started) {
|
||||||
|
throw new \LogicException('Cannot register a bag when the session is already started.');
|
||||||
|
}
|
||||||
|
|
||||||
$this->bags[$bag->getName()] = $bag;
|
$this->bags[$bag->getName()] = $bag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,16 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
|
|||||||
$storage->getBag('non_existing');
|
$storage->getBag('non_existing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testRegisterBagForAStartedSessionThrowsException()
|
||||||
|
{
|
||||||
|
$storage = $this->getStorage();
|
||||||
|
$storage->start();
|
||||||
|
$storage->registerBag(new AttributeBag());
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetId()
|
public function testGetId()
|
||||||
{
|
{
|
||||||
$storage = $this->getStorage();
|
$storage = $this->getStorage();
|
||||||
|
@ -663,10 +663,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
|||||||
$dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath())));
|
$dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath())));
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath()));
|
$content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath(), 'debug' => $this->debug));
|
||||||
if (!$this->debug) {
|
|
||||||
$content = static::stripComments($content);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cache->write($content, $container->getResources());
|
$cache->write($content, $container->getResources());
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/http-foundation": "~2.1|~3.0.0",
|
"symfony/http-foundation": "~2.1|~3.0.0",
|
||||||
"symfony/intl": "~2.4|~3.0.0",
|
"symfony/intl": "~2.7.4|~2.8|~3.0.0",
|
||||||
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0",
|
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0",
|
||||||
"symfony/config": "~2.2|~3.0.0",
|
"symfony/config": "~2.2|~3.0.0",
|
||||||
"symfony/property-access": "~2.3|~3.0.0",
|
"symfony/property-access": "~2.3|~3.0.0",
|
||||||
|
Reference in New Issue
Block a user