Merge branch '2.3' into 2.5
* 2.3: reformat code as suggested by @fabpot Fix typo Make `\Request::get` more performant. [FrameworkBundle] cache:clear command fills *.php.meta files with wrong data bumped Symfony version to 2.3.23 fixed typo updated VERSION for 2.3.22 update CONTRIBUTORS for 2.3.22 updated CHANGELOG for 2.3.22 Conflicts: src/Symfony/Component/HttpKernel/Kernel.php
This commit is contained in:
commit
5284b59fb9
@ -7,6 +7,21 @@ in 2.3 minor versions.
|
|||||||
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
|
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
|
||||||
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1
|
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1
|
||||||
|
|
||||||
|
* 2.3.22 (2014-11-20)
|
||||||
|
|
||||||
|
* bug #12525 [Bundle][FrameworkBundle] be smarter when guessing the document root (xabbuh)
|
||||||
|
* bug #12296 [SecurityBundle] Authentication entry point is only registered with firewall exception listener, not with authentication listeners (rjkip)
|
||||||
|
* bug #12393 [DependencyInjection] inlined factory not referenced (boekkooi)
|
||||||
|
* bug #12436 [Filesystem] Fixed case for empty folder (yosmanyga)
|
||||||
|
* bug #12370 [Yaml] improve error message for multiple documents (xabbuh)
|
||||||
|
* bug #12170 [Form] fix form handling with OPTIONS request method (Tobion)
|
||||||
|
* bug #12235 [Validator] Fixed Regex::getHtmlPattern() to work with complex and negated patterns (webmozart)
|
||||||
|
* bug #12326 [Session] remove invalid hack in session regenerate (Tobion)
|
||||||
|
* bug #12341 [Kernel] ensure session is saved before sending response (Tobion)
|
||||||
|
* bug #12329 [Routing] serialize the compiled route to speed things up (Tobion)
|
||||||
|
* bug #12316 Break infinite loop while resolving aliases (chx)
|
||||||
|
* bug #12313 [Security][listener] change priority of switchuser (aitboudad)
|
||||||
|
|
||||||
* 2.3.21 (2014-10-24)
|
* 2.3.21 (2014-10-24)
|
||||||
|
|
||||||
* bug #11696 [Form] Fix #11694 - Enforce options value type check in some form types (kix)
|
* bug #11696 [Form] Fix #11694 - Enforce options value type check in some form types (kix)
|
||||||
|
@ -127,6 +127,9 @@ EOF
|
|||||||
$tempKernel = $this->getTempKernel($realKernel, $namespace, $realKernelClass, $warmupDir);
|
$tempKernel = $this->getTempKernel($realKernel, $namespace, $realKernelClass, $warmupDir);
|
||||||
$tempKernel->boot();
|
$tempKernel->boot();
|
||||||
|
|
||||||
|
$tempKernelReflection = new \ReflectionObject($tempKernel);
|
||||||
|
$tempKernelFile = $tempKernelReflection->getFileName();
|
||||||
|
|
||||||
// warmup temporary dir
|
// warmup temporary dir
|
||||||
$warmer = $tempKernel->getContainer()->get('cache_warmer');
|
$warmer = $tempKernel->getContainer()->get('cache_warmer');
|
||||||
if ($enableOptionalWarmers) {
|
if ($enableOptionalWarmers) {
|
||||||
@ -162,6 +165,9 @@ EOF
|
|||||||
file_put_contents(str_replace($search, $replace, $file), $content);
|
file_put_contents(str_replace($search, $replace, $file), $content);
|
||||||
unlink($file);
|
unlink($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove temp kernel file after cache warmed up
|
||||||
|
@unlink($tempKernelFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,13 +207,30 @@ namespace $namespace
|
|||||||
{
|
{
|
||||||
return '$rootDir';
|
return '$rootDir';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function buildContainer()
|
||||||
|
{
|
||||||
|
\$container = parent::buildContainer();
|
||||||
|
|
||||||
|
// filter container's resources, removing reference to temp kernel file
|
||||||
|
\$resources = \$container->getResources();
|
||||||
|
\$filteredResources = array();
|
||||||
|
foreach (\$resources as \$resource) {
|
||||||
|
if ((string) \$resource !== __FILE__) {
|
||||||
|
\$filteredResources[] = \$resource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\$container->setResources(\$filteredResources);
|
||||||
|
|
||||||
|
return \$container;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF;
|
EOF;
|
||||||
$this->getContainer()->get('filesystem')->mkdir($warmupDir);
|
$this->getContainer()->get('filesystem')->mkdir($warmupDir);
|
||||||
file_put_contents($file = $warmupDir.'/kernel.tmp', $code);
|
file_put_contents($file = $warmupDir.'/kernel.tmp', $code);
|
||||||
require_once $file;
|
require_once $file;
|
||||||
@unlink($file);
|
|
||||||
$class = "$namespace\\$class";
|
$class = "$namespace\\$class";
|
||||||
|
|
||||||
return new $class($parent->getEnvironment(), $parent->isDebug());
|
return new $class($parent->getEnvironment(), $parent->isDebug());
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture\TestAppKernel;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
|
use Symfony\Component\Config\ConfigCache;
|
||||||
|
use Symfony\Component\Config\Resource\ResourceInterface;
|
||||||
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
|
use Symfony\Component\Console\Output\NullOutput;
|
||||||
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
|
class CacheClearCommandTest extends TestCase
|
||||||
|
{
|
||||||
|
/** @var TestAppKernel */
|
||||||
|
private $kernel;
|
||||||
|
/** @var Filesystem */
|
||||||
|
private $fs;
|
||||||
|
private $rootDir;
|
||||||
|
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
$this->fs = new Filesystem();
|
||||||
|
$this->kernel = new TestAppKernel('test', true);
|
||||||
|
$this->rootDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('sf2_cache_');
|
||||||
|
$this->kernel->setRootDir($this->rootDir);
|
||||||
|
$this->fs->mkdir($this->rootDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
$this->fs->remove($this->rootDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCacheIsFreshAfterCacheClearedWithWarmup()
|
||||||
|
{
|
||||||
|
$input = new ArrayInput(array('cache:clear'));
|
||||||
|
$application = new Application($this->kernel);
|
||||||
|
$application->setCatchExceptions(false);
|
||||||
|
|
||||||
|
$application->doRun($input, new NullOutput());
|
||||||
|
|
||||||
|
// Ensure that all *.meta files are fresh
|
||||||
|
$finder = new Finder();
|
||||||
|
$metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta');
|
||||||
|
// simply check that cache is warmed up
|
||||||
|
$this->assertGreaterThanOrEqual(1, count($metaFiles));
|
||||||
|
foreach ($metaFiles as $file) {
|
||||||
|
$configCache = new ConfigCache(substr($file, 0, -5), true);
|
||||||
|
$this->assertTrue(
|
||||||
|
$configCache->isFresh(),
|
||||||
|
sprintf(
|
||||||
|
'Meta file "%s" is not fresh',
|
||||||
|
(string) $file
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check that app kernel file present in meta file of container's cache
|
||||||
|
$containerRef = new \ReflectionObject($this->kernel->getContainer());
|
||||||
|
$containerFile = $containerRef->getFileName();
|
||||||
|
$containerMetaFile = $containerFile.'.meta';
|
||||||
|
$kernelRef = new \ReflectionObject($this->kernel);
|
||||||
|
$kernelFile = $kernelRef->getFileName();
|
||||||
|
/** @var ResourceInterface[] $meta */
|
||||||
|
$meta = unserialize(file_get_contents($containerMetaFile));
|
||||||
|
$found = false;
|
||||||
|
foreach ($meta as $resource) {
|
||||||
|
if ((string) $resource === $kernelFile) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->assertTrue($found, 'Kernel file should present as resource');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||||
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
|
|
||||||
|
class TestAppKernel extends Kernel
|
||||||
|
{
|
||||||
|
public function registerBundles()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
new FrameworkBundle(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRootDir($rootDir)
|
||||||
|
{
|
||||||
|
$this->rootDir = $rootDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||||
|
{
|
||||||
|
$loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
framework:
|
||||||
|
secret: test
|
@ -715,7 +715,19 @@ class Request
|
|||||||
*/
|
*/
|
||||||
public function get($key, $default = null, $deep = false)
|
public function get($key, $default = null, $deep = false)
|
||||||
{
|
{
|
||||||
return $this->query->get($key, $this->attributes->get($key, $this->request->get($key, $default, $deep), $deep), $deep);
|
if ($this !== $result = $this->query->get($key, $this, $deep)) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this !== $result = $this->attributes->get($key, $this, $deep)) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this !== $result = $this->request->get($key, $this, $deep)) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user