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 ...@@ -162,7 +162,7 @@ public function processOutbound($path, &$options = array(), Request $request = N
list(, $port) = explode(':', $normalized_base_url); list(, $port) = explode(':', $normalized_base_url);
$options['base_url'] .= ':' . $port; $options['base_url'] .= ':' . $port;
} }
elseif ($port != 80) { elseif (($url_scheme == 'http' && $port != 80) || ($url_scheme == 'https' && $port != 443)) {
$options['base_url'] .= ':' . $port; $options['base_url'] .= ':' . $port;
} }
......
...@@ -124,7 +124,9 @@ function testDomainNameNegotiationPort() { ...@@ -124,7 +124,9 @@ function testDomainNameNegotiationPort() {
// URLs as well. // URLs as well.
$index_php = strpos(url('', array('absolute' => TRUE)), 'index.php') !== FALSE; $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. // Create an absolute French link.
$language = language_load('fr'); $language = language_load('fr');
......
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php'; require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitc8a0ebe8345566b52e82e4437041f111::getLoader(); return ComposerAutoloaderInit8448fbbf88ecb044f224057d631a4472::getLoader();
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'), 'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'),
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
'Symfony\\Component\\PropertyAccess\\' => array($vendorDir . '/symfony/property-access'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInitc8a0ebe8345566b52e82e4437041f111 class ComposerAutoloaderInit8448fbbf88ecb044f224057d631a4472
{ {
private static $loader; private static $loader;
...@@ -19,9 +19,9 @@ public static function getLoader() ...@@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader; 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(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitc8a0ebe8345566b52e82e4437041f111', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit8448fbbf88ecb044f224057d631a4472', 'loadClassLoader'));
$vendorDir = dirname(__DIR__); $vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir)); $baseDir = dirname(dirname($vendorDir));
......
This diff is collapsed.
CHANGELOG CHANGELOG
========= =========
2.4.0
-----
* deprecated the DebugClassLoader as it has been moved to the Debug component instead
2.3.0 2.3.0
----- -----
......
...@@ -53,7 +53,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = ...@@ -53,7 +53,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive =
$classes = array_diff($classes, $declared); $classes = array_diff($classes, $declared);
// the cache is different depending on which classes are already 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); $classes = array_unique($classes);
......
...@@ -39,7 +39,7 @@ public static function dump($dirs, $file) ...@@ -39,7 +39,7 @@ public static function dump($dirs, $file)
/** /**
* Iterate over all files in the given directory searching for classes * 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 * @return array A class map array
*/ */
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
* @author Christophe Coevoet <stof@notk.org> * @author Christophe Coevoet <stof@notk.org>
* *
* @api * @api
*
* @deprecated Deprecated since version 2.4, to be removed in 3.0. Use the DebugClassLoader provided by the Debug component instead.
*/ */
class DebugClassLoader class DebugClassLoader
{ {
...@@ -39,6 +41,16 @@ public function __construct($classFinder) ...@@ -39,6 +41,16 @@ public function __construct($classFinder)
$this->classFinder = $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. * Replaces all autoloaders implementing a findFile method by a DebugClassLoader wrapper.
*/ */
......
...@@ -65,5 +65,5 @@ Resources ...@@ -65,5 +65,5 @@ Resources
You can run the unit tests with the following command: You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/ClassLoader/ $ cd path/to/Symfony/Component/ClassLoader/
$ composer.phar install --dev $ composer.phar install
$ phpunit $ phpunit
...@@ -189,7 +189,7 @@ public function getFixNamespaceDeclarationsDataWithoutTokenizer() ...@@ -189,7 +189,7 @@ public function getFixNamespaceDeclarationsDataWithoutTokenizer()
} }
/** /**
* @expectedException InvalidArgumentException * @expectedException \InvalidArgumentException
*/ */
public function testUnableToLoadClassException() public function testUnableToLoadClassException()
{ {
......
...@@ -72,7 +72,7 @@ public function testLoadNonexistentClass($className, $testClassName, $message) ...@@ -72,7 +72,7 @@ public function testLoadNonexistentClass($className, $testClassName, $message)
public function getLoadNonexistentClassTests() public function getLoadNonexistentClassTests()
{ {
return array( 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() ...@@ -120,10 +120,6 @@ public function getTestCreateMapTests()
public function testCreateMapFinderSupport() public function testCreateMapFinderSupport()
{ {
if (!class_exists('Symfony\\Component\\Finder\\Finder')) {
$this->markTestSkipped('Finder component is not available');
}
$finder = new \Symfony\Component\Finder\Finder(); $finder = new \Symfony\Component\Finder\Finder();
$finder->files()->in(__DIR__.'/Fixtures/beta/NamespaceCollision'); $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 @@ ...@@ -28,7 +28,7 @@
"target-dir": "Symfony/Component/ClassLoader", "target-dir": "Symfony/Component/ClassLoader",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.3-dev" "dev-master": "2.4-dev"
} }
} }
} }
CHANGELOG 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 2.2.0
----- -----
......
...@@ -28,6 +28,7 @@ class CheckCircularReferencesPass implements CompilerPassInterface ...@@ -28,6 +28,7 @@ class CheckCircularReferencesPass implements CompilerPassInterface
{ {
private $currentId; private $currentId;
private $currentPath; private $currentPath;
private $checkedNodes;
/** /**
* Checks the ContainerBuilder object for circular references. * Checks the ContainerBuilder object for circular references.
...@@ -38,6 +39,7 @@ public function process(ContainerBuilder $container) ...@@ -38,6 +39,7 @@ public function process(ContainerBuilder $container)
{ {
$graph = $container->getCompiler()->getServiceReferenceGraph(); $graph = $container->getCompiler()->getServiceReferenceGraph();
$this->checkedNodes = array();
foreach ($graph->getNodes() as $id => $node) { foreach ($graph->getNodes() as $id => $node) {
$this->currentId = $id; $this->currentId = $id;
$this->currentPath = array($id); $this->currentPath = array($id);
...@@ -58,15 +60,20 @@ private function checkOutEdges(array $edges) ...@@ -58,15 +60,20 @@ private function checkOutEdges(array $edges)
foreach ($edges as $edge) { foreach ($edges as $edge) {
$node = $edge->getDestNode(); $node = $edge->getDestNode();
$id = $node->getId(); $id = $node->getId();
$searchKey = array_search($id, $this->currentPath);
$this->currentPath[] = $id;
if (false !== $searchKey) { if (empty($this->checkedNodes[$id])) {
throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey)); $searchKey = array_search($id, $this->currentPath);
} $this->currentPath[] = $id;
$this->checkOutEdges($node->getOutEdges()); if (false !== $searchKey) {
array_pop($this->currentPath); 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) ...@@ -74,6 +74,17 @@ public function process(ContainerBuilder $container)
$id $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 @@ ...@@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Compiler; namespace Symfony\Component\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
/** /**
* This class is used to remove circular dependencies between individual passes. * This class is used to remove circular dependencies between individual passes.
...@@ -24,7 +23,7 @@ ...@@ -24,7 +23,7 @@
class Compiler class Compiler
{ {
private $passConfig; private $passConfig;
private $log;