diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index b0ae5fc814..1c2efe5874 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -26,6 +26,7 @@ use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper; use Symfony\Component\DependencyInjection\ExpressionLanguage; use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use Symfony\Component\HttpKernel\Kernel; /** * PhpDumper dumps a service container as a PHP class. @@ -57,6 +58,7 @@ class PhpDumper extends Dumper private $expressionLanguage; private $targetDirRegex; private $targetDirMaxMatches; + private $docStar; /** * @var ExpressionFunctionProviderInterface[] @@ -108,7 +110,9 @@ class PhpDumper extends Dumper 'class' => 'ProjectServiceContainer', 'base_class' => 'Container', 'namespace' => '', + 'debug' => true, ), $options); + $this->docStar = $options['debug'] ? '*' : ''; if (!empty($options['file']) && is_dir($dir = dirname($options['file']))) { // Build a regexp where the first root dirs are mandatory, @@ -233,9 +237,15 @@ class PhpDumper extends Dumper array($this->getProxyDumper(), 'isProxyCandidate') ); $code = ''; + $strip = '' === $this->docStar && method_exists('Symfony\Component\HttpKernel\Kernel', 'stripComments'); foreach ($definitions as $definition) { - $code .= "\n".$this->getProxyDumper()->getProxyCode($definition); + $proxyCode = "\n".$this->getProxyDumper()->getProxyCode($definition); + if ($strip) { + $proxyCode = "docStar} * Gets the '$id' service.$doc *$lazyInitializationDoc * $return @@ -737,7 +747,7 @@ EOF; return <<docStar} * Updates the '$id' service. */ protected function synchronize{$this->camelize($id)}Service() @@ -829,7 +839,7 @@ use Symfony\Component\DependencyInjection\Exception\LogicException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; $bagClass -/** +/*{$this->docStar} * $class. * * This class has been auto-generated @@ -855,7 +865,7 @@ EOF; $code = <<docStar} * Constructor. */ public function __construct() @@ -892,7 +902,7 @@ EOF; $code = <<docStar} * Constructor. */ public function __construct() @@ -939,7 +949,7 @@ EOF; { return <<docStar} * {@inheritdoc} */ public function compile() @@ -1060,11 +1070,14 @@ EOF; } EOF; + if ('' === $this->docStar) { + $code = str_replace('/**', '/*', $code); + } } $code .= <<docStar} * Gets the default parameters. * * @return array An array of the default parameters diff --git a/src/Symfony/Component/Finder/Iterator/FilterIterator.php b/src/Symfony/Component/Finder/Iterator/FilterIterator.php index 24adeb68f9..3c3c3fbec0 100644 --- a/src/Symfony/Component/Finder/Iterator/FilterIterator.php +++ b/src/Symfony/Component/Finder/Iterator/FilterIterator.php @@ -39,11 +39,18 @@ abstract class FilterIterator extends \FilterIterator while ($iterator instanceof \OuterIterator) { $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->rewind(); } - $iterator = $iterator->getInnerIterator(); + + $iterator = $innerIterator; } parent::rewind(); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 137f0e8e1c..aa4a237cdd 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -260,6 +260,10 @@ class NativeSessionStorage implements SessionStorageInterface */ 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; } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 121cff37a1..160b575862 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -83,6 +83,16 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase $storage->getBag('non_existing'); } + /** + * @expectedException \LogicException + */ + public function testRegisterBagForAStartedSessionThrowsException() + { + $storage = $this->getStorage(); + $storage->start(); + $storage->registerBag(new AttributeBag()); + } + public function testGetId() { $storage = $this->getStorage(); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index aa7dbff03c..0c1465e1b0 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -662,10 +662,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath()))); } - $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath())); - if (!$this->debug) { - $content = static::stripComments($content); - } + $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath(), 'debug' => $this->debug)); $cache->write($content, $container->getResources()); } diff --git a/src/Symfony/Component/Validator/composer.json b/src/Symfony/Component/Validator/composer.json index effc4d7db4..c74b46e68c 100644 --- a/src/Symfony/Component/Validator/composer.json +++ b/src/Symfony/Component/Validator/composer.json @@ -22,7 +22,7 @@ "require-dev": { "doctrine/common": "~2.3", "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.7.4", + "symfony/intl": "~2.7.4|~2.8", "symfony/yaml": "~2.0,>=2.0.5", "symfony/config": "~2.2", "symfony/property-access": "~2.3",