Navigation Menu

Skip to content

Commit

Permalink
Merge branch '2.8'
Browse files Browse the repository at this point in the history
* 2.8: (100 commits)
  [DependencyInjection] provide better error message when using deprecated configuration options
  [console][TableCell] get cell width without decoration.
  Improve the config validation in TwigBundle
  [VarDumper] Changed tooltip to expand-all keybinding in OS X
  [Bridge\PhpUnit] Fix composer installed phpunit detection
  [VarDumper] Fix generic casters calling order
  [2.7][SecurityBundle] Remove SecurityContext from Compile
  [WebProfilerBundle][logger] added missing deprecation message.
  Fix profiler CSS
  [Security][Acl] enforce string identifiers
  [FrameworkBundle] make `templating.helper.router` service available again for BC reasons
  [BrowserKit] Fix bug when uri starts with http.
  bumped Symfony version to 2.7.1
  updated VERSION for 2.7.0
  updated CHANGELOG for 2.7.0
  bumped Symfony version to 2.6.10
  updated VERSION for 2.6.9
  updated CHANGELOG for 2.6.9
  fixed tests
  bumped Symfony version to 2.3.31
  ...

Conflicts:
	CHANGELOG-2.3.md
	CHANGELOG-2.6.md
	CHANGELOG-2.7.md
	UPGRADE-2.7.md
	UPGRADE-3.0.md
	src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
	src/Symfony/Bridge/Twig/Extension/AssetExtension.php
	src/Symfony/Bridge/Twig/Tests/Extension/AssetExtensionTest.php
	src/Symfony/Bridge/Twig/composer.json
	src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
	src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml
	src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml
	src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
	src/Symfony/Bundle/FrameworkBundle/composer.json
	src/Symfony/Bundle/SecurityBundle/composer.json
	src/Symfony/Component/Debug/ExceptionHandler.php
	src/Symfony/Component/DependencyInjection/Container.php
	src/Symfony/Component/DependencyInjection/Definition.php
	src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
	src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/legacy-services6.xml
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/legacy-services6.yml
	src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml
	src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
	src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
	src/Symfony/Component/Form/CHANGELOG.md
	src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php
	src/Symfony/Component/HttpKernel/Tests/DependencyInjection/ContainerAwareHttpKernelTest.php
	src/Symfony/Component/Routing/Loader/XmlFileLoader.php
	src/Symfony/Component/Routing/Loader/YamlFileLoader.php
  • Loading branch information
fabpot committed Jun 4, 2015
2 parents 20f4ca1 + f479a54 commit ca1a985
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 13 deletions.
4 changes: 4 additions & 0 deletions Bundle/Bundle.php
Expand Up @@ -76,6 +76,10 @@ public function getContainerExtension()
if (class_exists($class)) {
$extension = new $class();

if (!$extension instanceof ExtensionInterface) {
throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.', $class));
}

// check naming convention
$basename = preg_replace('/Bundle$/', '', $this->getName());
$expectedAlias = Container::underscore($basename);
Expand Down
6 changes: 3 additions & 3 deletions DataCollector/DumpDataCollector.php
Expand Up @@ -95,9 +95,9 @@ public function dump(Data $data)
$name = $info->getTemplateName();
$src = $info->getEnvironment()->getLoader()->getSource($name);
$info = $info->getDebugInfo();
if (isset($info[$trace[$i-1]['line']])) {
if (isset($info[$trace[$i - 1]['line']])) {
$file = false;
$line = $info[$trace[$i-1]['line']];
$line = $info[$trace[$i - 1]['line']];
$src = explode("\n", $src);
$fileExcerpt = array();

Expand Down Expand Up @@ -255,7 +255,7 @@ private function doDump($data, $name, $file, $line)
$name = strip_tags($this->style('', $name));
$file = strip_tags($this->style('', $file));
if ($fileLinkFormat) {
$link = strtr($fileLinkFormat, array('%f' => $file, '%l' => (int) $line));
$link = strtr(strip_tags($this->style('', $fileLinkFormat)), array('%f' => $file, '%l' => (int) $line));
$name = sprintf('<a href="%s" title="%s">'.$s.'</a>', $link, $file, $name);
} else {
$name = sprintf('<abbr title="%s">'.$s.'</abbr>', $file, $name);
Expand Down
4 changes: 2 additions & 2 deletions DataCollector/RequestDataCollector.php
Expand Up @@ -129,7 +129,7 @@ public function collect(Request $request, Response $response, \Exception $except
$this->data['controller'] = array(
'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0],
'method' => $controller[1],
'file' => $r->getFilename(),
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
);
} catch (\ReflectionException $re) {
Expand All @@ -148,7 +148,7 @@ public function collect(Request $request, Response $response, \Exception $except
$this->data['controller'] = array(
'class' => $r->getName(),
'method' => null,
'file' => $r->getFilename(),
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
);
} elseif (is_object($controller)) {
Expand Down
2 changes: 1 addition & 1 deletion EventListener/FragmentListener.php
Expand Up @@ -57,7 +57,7 @@ public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();

if ($this->fragmentPath !== rawurldecode($request->getPathInfo())) {
if ($request->attributes->has('_controller') || $this->fragmentPath !== rawurldecode($request->getPathInfo())) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion HttpCache/HttpCache.php
Expand Up @@ -369,7 +369,7 @@ protected function validate(Request $request, Response $entry, $catch = false)
// We keep the etags from the client to handle the case when the client
// has a different private valid entry which is not cached here.
$cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array();
$requestEtags = $request->getEtags();
$requestEtags = $request->getETags();
if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) {
$subRequest->headers->set('if_none_match', implode(', ', $etags));
}
Expand Down
2 changes: 1 addition & 1 deletion HttpCache/Store.php
Expand Up @@ -127,7 +127,7 @@ public function lookup(Request $request)
// find a cached entry that matches the request.
$match = null;
foreach ($entries as $entry) {
if ($this->requestsMatch(isset($entry[1]['vary'][0]) ? $entry[1]['vary'][0] : '', $request->headers->all(), $entry[0])) {
if ($this->requestsMatch(isset($entry[1]['vary'][0]) ? implode(', ', $entry[1]['vary']) : '', $request->headers->all(), $entry[0])) {
$match = $entry;

break;
Expand Down
2 changes: 1 addition & 1 deletion Profiler/MemcacheProfilerStorage.php
Expand Up @@ -41,7 +41,7 @@ protected function getMemcache()
$port = $matches[3];

$memcache = new \Memcache();
$memcache->addServer($host, $port);
$memcache->addserver($host, $port);

$this->memcache = $memcache;
}
Expand Down
11 changes: 11 additions & 0 deletions Tests/Bundle/BundleTest.php
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\HttpKernel\Tests\Bundle;

use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle;
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle;
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle;
use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand;
Expand All @@ -30,4 +31,14 @@ public function testRegisterCommands()

$this->assertNull($bundle2->registerCommands($app));
}

/**
* @expectedException \LogicException
* @expectedExceptionMessage must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface
*/
public function testGetContainerExtensionWithInvalidClass()
{
$bundle = new ExtensionNotValidBundle();
$bundle->getContainerExtension();
}
}
4 changes: 2 additions & 2 deletions Tests/DataCollector/ConfigDataCollectorTest.php
Expand Up @@ -37,9 +37,9 @@ public function testCollect()

// if else clause because we don't know it
if (extension_loaded('xdebug')) {
$this->assertTrue($c->hasXdebug());
$this->assertTrue($c->hasXDebug());
} else {
$this->assertFalse($c->hasXdebug());
$this->assertFalse($c->hasXDebug());
}

// if else clause because we don't know it
Expand Down
20 changes: 18 additions & 2 deletions Tests/EventListener/FragmentListenerTest.php
Expand Up @@ -34,6 +34,22 @@ public function testOnlyTriggeredOnFragmentRoute()
$this->assertTrue($request->query->has('_path'));
}


public function testOnlyTriggeredIfControllerWasNotDefinedYet()
{
$request = Request::create('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo');
$request->attributes->set('_controller', 'bar');

$listener = new FragmentListener(new UriSigner('foo'));
$event = $this->createGetResponseEvent($request, HttpKernelInterface::SUB_REQUEST);

$expected = $request->attributes->all();

$listener->onKernelRequest($event);

$this->assertEquals($expected, $request->attributes->all());
}

/**
* @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
*/
Expand Down Expand Up @@ -74,8 +90,8 @@ public function testWithSignature()
$this->assertFalse($request->query->has('_path'));
}

private function createGetResponseEvent(Request $request)
private function createGetResponseEvent(Request $request, $requestType = HttpKernelInterface::MASTER_REQUEST)
{
return new GetResponseEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, HttpKernelInterface::MASTER_REQUEST);
return new GetResponseEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, $requestType);
}
}
@@ -0,0 +1,20 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\DependencyInjection;

class ExtensionNotValidExtension
{
public function getAlias()
{
return 'extension_not_valid';
}
}
18 changes: 18 additions & 0 deletions Tests/Fixtures/ExtensionNotValidBundle/ExtensionNotValidBundle.php
@@ -0,0 +1,18 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ExtensionNotValidBundle extends Bundle
{
}
10 changes: 10 additions & 0 deletions Tests/HttpCache/StoreTest.php
Expand Up @@ -168,6 +168,16 @@ public function testDoesNotReturnEntriesThatVaryWithLookup()
$this->assertNull($this->store->lookup($req2));
}

public function testDoesNotReturnEntriesThatSlightlyVaryWithLookup()
{
$req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar'));
$req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bam'));
$res = new Response('test', 200, array('Vary' => array('Foo', 'Bar')));
$this->store->write($req1, $res);

$this->assertNull($this->store->lookup($req2));
}

public function testStoresMultipleResponsesForEachVaryCombination()
{
$req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar'));
Expand Down

0 comments on commit ca1a985

Please sign in to comment.