Commit 8b0cb059 authored by webchick's avatar webchick

Issue #2161397 by dawehner, tim.plunkett, Crell: Update to Symfony 2.4.1.

parent bb05d952
This diff is collapsed.
......@@ -162,7 +162,7 @@ public function processOutbound($path, &$options = array(), Request $request = N
list(, $port) = explode(':', $normalized_base_url);
$options['base_url'] .= ':' . $port;
}
elseif ($port != 80) {
elseif (($url_scheme == 'http' && $port != 80) || ($url_scheme == 'https' && $port != 443)) {
$options['base_url'] .= ':' . $port;
}
......
......@@ -124,7 +124,9 @@ function testDomainNameNegotiationPort() {
// URLs as well.
$index_php = strpos(url('', array('absolute' => TRUE)), 'index.php') !== FALSE;
$request = $this->prepareRequestForGenerator(TRUE, array('SERVER_PORT' => '88'));
$request = Request::createFromGlobals();
$server = $request->server->all();
$request = $this->prepareRequestForGenerator(TRUE, array('HTTP_HOST' => $server['HTTP_HOST'] . ':88'));
// Create an absolute French link.
$language = language_load('fr');
......
......@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitc8a0ebe8345566b52e82e4437041f111::getLoader();
return ComposerAutoloaderInit8448fbbf88ecb044f224057d631a4472::getLoader();
......@@ -15,6 +15,7 @@
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'),
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
'Symfony\\Component\\PropertyAccess\\' => array($vendorDir . '/symfony/property-access'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
......
......@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitc8a0ebe8345566b52e82e4437041f111
class ComposerAutoloaderInit8448fbbf88ecb044f224057d631a4472
{
private static $loader;
......@@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitc8a0ebe8345566b52e82e4437041f111', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit8448fbbf88ecb044f224057d631a4472', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitc8a0ebe8345566b52e82e4437041f111', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit8448fbbf88ecb044f224057d631a4472', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
......
This diff is collapsed.
CHANGELOG
=========
2.4.0
-----
* deprecated the DebugClassLoader as it has been moved to the Debug component instead
2.3.0
-----
......
......@@ -53,7 +53,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
$classes = array_diff($classes, $declared);
// the cache is different depending on which classes are already declared
$name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5);
$name = $name.'-'.substr(hash('sha256', implode('|', $classes)), 0, 5);
}
$classes = array_unique($classes);
......
......@@ -39,7 +39,7 @@ public static function dump($dirs, $file)
/**
* Iterate over all files in the given directory searching for classes
*
* @param Iterator|string $dir The directory to search in or an iterator
* @param \Iterator|string $dir The directory to search in or an iterator
*
* @return array A class map array
*/
......
......@@ -22,6 +22,8 @@
* @author Christophe Coevoet <stof@notk.org>
*
* @api
*
* @deprecated Deprecated since version 2.4, to be removed in 3.0. Use the DebugClassLoader provided by the Debug component instead.
*/
class DebugClassLoader
{
......@@ -39,6 +41,16 @@ public function __construct($classFinder)
$this->classFinder = $classFinder;
}
/**
* Gets the wrapped class loader.
*
* @return object a class loader instance
*/
public function getClassLoader()
{
return $this->classFinder;
}
/**
* Replaces all autoloaders implementing a findFile method by a DebugClassLoader wrapper.
*/
......
......@@ -65,5 +65,5 @@ Resources
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/ClassLoader/
$ composer.phar install --dev
$ composer.phar install
$ phpunit
......@@ -189,7 +189,7 @@ public function getFixNamespaceDeclarationsDataWithoutTokenizer()
}
/**
* @expectedException InvalidArgumentException
* @expectedException \InvalidArgumentException
*/
public function testUnableToLoadClassException()
{
......
......@@ -72,7 +72,7 @@ public function testLoadNonexistentClass($className, $testClassName, $message)
public function getLoadNonexistentClassTests()
{
return array(
array('\\Pearlike3_Bar', '\\Pearlike3_Bar', '->loadClass() loads non exising Pearlike3_Bar class with a leading slash'),
array('\\Pearlike3_Bar', '\\Pearlike3_Bar', '->loadClass() loads non existing Pearlike3_Bar class with a leading slash'),
);
}
......
......@@ -120,10 +120,6 @@ public function getTestCreateMapTests()
public function testCreateMapFinderSupport()
{
if (!class_exists('Symfony\\Component\\Finder\\Finder')) {
$this->markTestSkipped('Finder component is not available');
}
$finder = new \Symfony\Component\Finder\Finder();
$finder->files()->in(__DIR__.'/Fixtures/beta/NamespaceCollision');
......
<?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\ClassLoader\Tests;
use Symfony\Component\ClassLoader\ClassLoader;
use Symfony\Component\ClassLoader\DebugClassLoader;
class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
{
private $loader;
protected function setUp()
{
$this->loader = new ClassLoader();
spl_autoload_register(array($this->loader, 'loadClass'));
}
protected function tearDown()
{
spl_autoload_unregister(array($this->loader, 'loadClass'));
}
public function testIdempotence()
{
DebugClassLoader::enable();
DebugClassLoader::enable();
$functions = spl_autoload_functions();
foreach ($functions as $function) {
if (is_array($function) && $function[0] instanceof DebugClassLoader) {
$reflClass = new \ReflectionClass($function[0]);
$reflProp = $reflClass->getProperty('classFinder');
$reflProp->setAccessible(true);
$this->assertNotInstanceOf('Symfony\Component\ClassLoader\DebugClassLoader', $reflProp->getValue($function[0]));
return;
}
}
throw new \Exception('DebugClassLoader did not register');
}
}
......@@ -28,7 +28,7 @@
"target-dir": "Symfony/Component/ClassLoader",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "2.4-dev"
}
}
}
CHANGELOG
=========
2.4.0
-----
* added support for expressions in service definitions
* added ContainerAwareTrait to add default container aware behavior to a class
2.2.0
-----
......
......@@ -28,6 +28,7 @@ class CheckCircularReferencesPass implements CompilerPassInterface
{
private $currentId;
private $currentPath;
private $checkedNodes;
/**
* Checks the ContainerBuilder object for circular references.
......@@ -38,6 +39,7 @@ public function process(ContainerBuilder $container)
{
$graph = $container->getCompiler()->getServiceReferenceGraph();
$this->checkedNodes = array();
foreach ($graph->getNodes() as $id => $node) {
$this->currentId = $id;
$this->currentPath = array($id);
......@@ -58,15 +60,20 @@ private function checkOutEdges(array $edges)
foreach ($edges as $edge) {
$node = $edge->getDestNode();
$id = $node->getId();
$searchKey = array_search($id, $this->currentPath);
$this->currentPath[] = $id;
if (false !== $searchKey) {
throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey));
}
if (empty($this->checkedNodes[$id])) {
$searchKey = array_search($id, $this->currentPath);
$this->currentPath[] = $id;
$this->checkOutEdges($node->getOutEdges());
array_pop($this->currentPath);
if (false !== $searchKey) {
throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey));
}
$this->checkOutEdges($node->getOutEdges());
$this->checkedNodes[$id] = true;
array_pop($this->currentPath);
}
}
}
}
......@@ -74,6 +74,17 @@ public function process(ContainerBuilder $container)
$id
));
}
// tag attribute values must be scalars
foreach ($definition->getTags() as $name => $tags) {
foreach ($tags as $attributes) {
foreach ($attributes as $attribute => $value) {
if (!is_scalar($value) && null !== $value) {
throw new RuntimeException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $name, $attribute));
}
}
}
}
}
}
}
......@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
/**
* This class is used to remove circular dependencies between individual passes.
......@@ -24,7 +23,7 @@
class Compiler
{
private $passConfig;
private $log;
private $log = array();
private $loggingFormatter;
private $serviceReferenceGraph;
......@@ -36,7 +35,6 @@ public function __construct()
$this->passConfig = new PassConfig();
$this->serviceReferenceGraph = new ServiceReferenceGraph();
$this->loggingFormatter = new LoggingFormatter();
$this->log = array();
}
/**
......
......@@ -117,7 +117,7 @@ private function isInlineableDefinition(ContainerBuilder $container, $id, Defini
return true;
}
if ($definition->isPublic()) {
if ($definition->isPublic() || $definition->isLazy()) {
return false;
}
......@@ -125,6 +125,10 @@ private function isInlineableDefinition(ContainerBuilder $container, $id, Defini
return true;
}
if ($this->currentId == $id) {
return false;
}
$ids = array();
foreach ($this->graph->getNode($id)->getInEdges() as $edge) {
$ids[] = $edge->getSourceNode()->getId();
......
......@@ -31,9 +31,9 @@ class PassConfig
const TYPE_REMOVE = 'removing';
private $mergePass;
private $afterRemovingPasses;
private $beforeOptimizationPasses;
private $beforeRemovingPasses;
private $afterRemovingPasses = array();
private $beforeOptimizationPasses = array();
private $beforeRemovingPasses = array();
private $optimizationPasses;
private $removingPasses;
......@@ -44,10 +44,6 @@ public function __construct()
{
$this->mergePass = new MergeExtensionConfigurationPass();
$this->afterRemovingPasses = array();
$this->beforeOptimizationPasses = array();
$this->beforeRemovingPasses = array();
$this->optimizationPasses = array(
new ResolveDefinitionTemplatesPass(),
new ResolveParameterPlaceHoldersPass(),
......
......@@ -112,7 +112,7 @@ private function resolveDefinition($id, DefinitionDecorator $definition)
if (isset($changes['public'])) {
$def->setPublic($definition->isPublic());
}
if (isset($changes['lazy'])){
if (isset($changes['lazy'])) {
$def->setLazy($definition->isLazy());
}
......
......@@ -26,15 +26,7 @@ class ServiceReferenceGraph
/**
* @var ServiceReferenceGraphNode[]
*/
private $nodes;
/**
* Constructor.
*/
public function __construct()
{
$this->nodes = array();
}
private $nodes = array();
/**
* Checks if the graph has a specific node.
......
......@@ -24,8 +24,8 @@
class ServiceReferenceGraphNode
{
private $id;
private $inEdges;
private $outEdges;
private $inEdges = array();
private $outEdges = array();
private $value;
/**
......@@ -38,8 +38,6 @@ public function __construct($id, $value)
{
$this->id = $id;
$this->value = $value;
$this->inEdges = array();
$this->outEdges = array();
}
/**
......
......@@ -67,13 +67,13 @@ class Container implements IntrospectableContainerInterface
*/
protected $parameterBag;
protected $services;
protected $methodMap;
protected $aliases;
protected $scopes;
protected $scopeChildren;
protected $scopedServices;
protected $scopeStacks;
protected $services = array();
protected $methodMap = array();
protected $aliases = array();
protected $scopes = array();
protected $scopeChildren = array();
protected $scopedServices = array();
protected $scopeStacks = array();
protected $loading = array();
/**
......@@ -85,14 +85,7 @@ class Container implements IntrospectableContainerInterface
*/
public function __construct(ParameterBagInterface $parameterBag = null)
{
$this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag;
$this->services = array();
$this->aliases = array();
$this->scopes = array();
$this->scopeChildren = array();
$this->scopedServices = array();
$this->scopeStacks = array();
$this->parameterBag = $parameterBag ?: new ParameterBag();
$this->set('service_container', $this);
}
......@@ -214,7 +207,7 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER)
$this->services[$id] = $service;
if (method_exists($this, $method = 'synchronize'.strtr($id, array('_' => '', '.' => '_')).'Service')) {
if (method_exists($this, $method = 'synchronize'.strtr($id, array('_' => '', '.' => '_', '\\' => '_')).'Service')) {
$this->$method();
}
...