Merge branch '2.3' into 2.7

* 2.3:
  updated VERSION for 2.3.42
  update CONTRIBUTORS for 2.3.42
  updated CHANGELOG for 2.3.42
  Revert "bug #18908 [DependencyInjection] force enabling the external XML entity loaders (xabbuh)"
  Partial revert of previous PR
  [DependencyInjection] Skip deep reference check for 'service_container'
  Catch \Throwable
  [Serializer] Add missing @throws annotations
  Fix for #18843
  force enabling the external XML entity loaders
  Removed UTC specification with timestamp
This commit is contained in:
Fabien Potencier 2016-06-06 10:55:42 +02:00
commit 011d2dcd26
22 changed files with 206 additions and 26 deletions

View File

@ -7,6 +7,22 @@ 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 between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1
* 2.3.42 (2016-05-30)
* bug #18908 [DependencyInjection] force enabling the external XML entity loaders (xabbuh)
* bug #18893 [DependencyInjection] Skip deep reference check for 'service_container' (RobertMe)
* bug #18812 Catch \Throwable (fprochazka)
* bug #18821 [Form] Removed UTC specification with timestamp (francisbesset)
* bug #18861 Fix for #18843 (inso)
* bug #18907 [Routing] Fix the annotation loader taking a class constant as a beginning of a class name (jakzal, nicolas-grekas)
* bug #18864 [Console][DX] Fixed ambiguous error message when using a duplicate option shortcut (peterrehm)
* bug #18844 [Yaml] fix exception contexts (xabbuh)
* bug #18840 [Yaml] properly handle unindented collections (xabbuh)
* bug #18839 People - person singularization (Keeo)
* bug #18828 [Yaml] chomp newlines only at the end of YAML documents (xabbuh)
* bug #18635 [Console] Prevent fatal error when calling Command::getHelper without helperSet (chalasr)
* bug #18761 [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper (issei-m)
* 2.3.41 (2016-05-09)
* security #18733 limited the maximum length of a submitted username (fabpot)

View File

@ -23,8 +23,8 @@ Symfony is the result of the work of many people who made the code better
- Pascal Borreli (pborreli)
- Joseph Bielawski (stloyd)
- Wouter De Jong (wouterj)
- Karma Dordrak (drak)
- Romain Neutron (romain)
- Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith)
- Martin Hasoň (hason)
- Jeremy Mikola (jmikola)
@ -53,11 +53,11 @@ Symfony is the result of the work of many people who made the code better
- Bilal Amarni (bamarni)
- Florin Patan (florinpatan)
- Kevin Bond (kbond)
- Peter Rehm (rpet)
- Gábor Egyed (1ed)
- Michel Weimerskirch (mweimerskirch)
- Eric Clemmons (ericclemmons)
- Andrej Hudec (pulzarraider)
- Peter Rehm (rpet)
- Christian Raue
- Matthias Pigulla (mpdude)
- Deni
@ -67,6 +67,7 @@ Symfony is the result of the work of many people who made the code better
- Iltar van der Berg (kjarli)
- Ener-Getick (energetick)
- Douglas Greenshields (shieldo)
- Charles Sarrazin (csarrazi)
- Lee McDermott
- Brandon Turner
- Luis Cordova (cordoval)
@ -74,7 +75,6 @@ Symfony is the result of the work of many people who made the code better
- Pierre du Plessis (pierredup)
- Bart van den Burg (burgov)
- Jordan Alliot (jalliot)
- Charles Sarrazin (csarrazi)
- John Wards (johnwards)
- Toni Uebernickel (havvg)
- Fran Moreno (franmomu)
@ -89,6 +89,7 @@ Symfony is the result of the work of many people who made the code better
- Alexander M. Turek (derrabus)
- Dariusz Ruminski
- marc.weistroff
- Issei Murasawa (issei_m)
- lenar
- Włodzimierz Gajda (gajdaw)
- Alexander Schwenn (xelaris)
@ -97,13 +98,12 @@ Symfony is the result of the work of many people who made the code better
- Colin Frei
- Adrien Brault (adrienbrault)
- Joshua Thijssen
- Issei Murasawa (issei_m)
- Baptiste Clavié (talus)
- Peter Kokot (maastermedia)
- excelwebzone
- Jacob Dreesen (jdreesen)
- Jérémy DERUSSÉ (jderusse)
- Vladimir Reznichenko (kalessil)
- Baptiste Clavié (talus)
- Fabien Pennequin (fabienpennequin)
- Gordon Franke (gimler)
- David Buchmann (dbu)
@ -121,6 +121,7 @@ Symfony is the result of the work of many people who made the code better
- Evgeniy (ewgraf)
- Guilherme Blanco (guilhermeblanco)
- Pablo Godel (pgodel)
- Titouan Galopin (tgalopin)
- Jérémie Augustin (jaugustin)
- Sebastiaan Stok (sstok)
- Tugdual Saunier (tucksaun)
@ -129,10 +130,10 @@ Symfony is the result of the work of many people who made the code better
- Arnaud Kleinpeter (nanocom)
- Joel Wurtz (brouznouf)
- Philipp Wahala (hifi)
- Titouan Galopin (tgalopin)
- Richard Shank (iampersistent)
- Thomas Rabaix (rande)
- Vincent AUBERT (vincent)
- Rouven Weßling (realityking)
- Mikael Pajunen
- Clemens Tolboom
- Helmer Aaviksoo
@ -143,7 +144,6 @@ Symfony is the result of the work of many people who made the code better
- Amal Raghav (kertz)
- Jonathan Ingram (jonathaningram)
- Artur Kotyrba
- Rouven Weßling (realityking)
- Warnar Boekkooi (boekkooi)
- Dmitrii Chekaliuk (lazyhammer)
- Clément JOBEILI (dator)
@ -211,6 +211,7 @@ Symfony is the result of the work of many people who made the code better
- Kristen Gilden (kgilden)
- Dawid Nowak
- Pierre-Yves LEBECQ (pylebecq)
- Daniel Espendiller
- Jakub Kucharovic (jkucharovic)
- Eugene Leonovich (rybakit)
- Filippo Tessarotto
@ -240,7 +241,6 @@ Symfony is the result of the work of many people who made the code better
- Michael Holm (hollo)
- Marc Weistroff (futurecat)
- Hidde Wieringa (hiddewie)
- Daniel Espendiller
- Chris Smith (cs278)
- Florian Klein (docteurklein)
- Manuel Kiessling (manuelkiessling)
@ -293,6 +293,7 @@ Symfony is the result of the work of many people who made the code better
- Inal DJAFAR (inalgnu)
- Christian Gärtner (dagardner)
- Tomasz Kowalczyk (thunderer)
- Christian Schmidt
- François-Xavier de Guillebon (de-gui_f)
- Damien Alexandre (damienalexandre)
- Felix Labrecque
@ -309,6 +310,7 @@ Symfony is the result of the work of many people who made the code better
- Philipp Kräutli (pkraeutli)
- Kirill chEbba Chebunin (chebba)
- Greg Thornton (xdissent)
- Robin Chalas (chalas_r)
- Costin Bereveanu (schniper)
- Loïc Chardonnet (gnusat)
- Marek Kalnik (marekkalnik)
@ -319,12 +321,14 @@ Symfony is the result of the work of many people who made the code better
- Pavel Volokitin (pvolok)
- Endre Fejes
- Tobias Naumann (tna)
- Daniel Beyer
- Shein Alexey
- Baptiste Lafontaine
- Joe Lencioni
- Daniel Tschinder
- Kai
- Lee Rowlands
- Krzysztof Piasecki (krzysztek)
- Maximilian Reichel (phramz)
- Loick Piera (pyrech)
- Karoly Negyesi (chx)
@ -364,7 +368,6 @@ Symfony is the result of the work of many people who made the code better
- EdgarPE
- Florian Pfitzer (marmelatze)
- Asier Illarramendi (doup)
- Christian Schmidt
- Chris Sedlmayr (catchamonkey)
- Seb Koelen
- Christoph Mewes (xrstf)
@ -382,6 +385,7 @@ Symfony is the result of the work of many people who made the code better
- Mathieu Lemoine
- franek (franek)
- Christian Wahler
- Mathieu Lemoine
- Gintautas Miselis
- Zander Baldwin
- Adam Harvey
@ -419,7 +423,6 @@ Symfony is the result of the work of many people who made the code better
- Anthony Ferrara
- Ioan Negulescu
- Jakub Škvára (jskvara)
- Daniel Beyer
- Andrew Udvare (audvare)
- alexpods
- Tristan Darricau (nicofuma)
@ -448,6 +451,7 @@ Symfony is the result of the work of many people who made the code better
- Denis Gorbachev (starfall)
- Peter van Dommelen
- Tim van Densen
- Martin Morávek (keeo)
- Steven Surowiec
- Kevin Saliou (kbsali)
- NothingWeAre
@ -462,7 +466,6 @@ Symfony is the result of the work of many people who made the code better
- Ziumin
- Jeremy Benoist
- Lenar Lõhmus
- Krzysztof Piasecki (krzysztek)
- Benjamin Laugueux (yzalis)
- Zach Badgett (zachbadgett)
- Aurélien Fredouelle
@ -501,6 +504,7 @@ Symfony is the result of the work of many people who made the code better
- Javier López (loalf)
- Reinier Kip
- Dustin Dobervich (dustin10)
- dantleech
- Anne-Sophie Bachelard (annesophie)
- Sebastian Marek (proofek)
- Erkhembayar Gantulga (erheme318)
@ -563,6 +567,7 @@ Symfony is the result of the work of many people who made the code better
- Peter Ward
- Dominik Ritter (dritter)
- Sebastian Grodzicki (sgrodzicki)
- SpacePossum
- Martin Hujer (martinhujer)
- Pascal Helfenstein
- Baldur Rensch (brensch)
@ -613,6 +618,7 @@ Symfony is the result of the work of many people who made the code better
- Adrien Lucas (adrienlucas)
- James Michael DuPont
- Tom Klingenberg
- Filip Procházka (fprochazka)
- Christopher Hall (mythmakr)
- Paul Kamer (pkamer)
- Rafał Wrzeszcz (rafalwrzeszcz)
@ -629,6 +635,7 @@ Symfony is the result of the work of many people who made the code better
- Alaattin Kahramanlar (alaattin)
- Maksim Kotlyar (makasim)
- Neil Ferreira
- Nathanael Noblet (gnat)
- Dmitry Parnas (parnas)
- Théo FIDRY (theofidry)
- Paul LE CORRE
@ -745,7 +752,6 @@ Symfony is the result of the work of many people who made the code better
- Guillaume Royer
- Artem (digi)
- boite
- dantleech
- Vadim Tyukov (vatson)
- Sortex
- chispita
@ -851,6 +857,7 @@ Symfony is the result of the work of many people who made the code better
- Christian Sciberras
- Anton Bakai
- Clement Herreman (clemherreman)
- Dan Ionut Dumitriu (danionut90)
- Nyro (nyro)
- Marco
- Marc Torres
@ -870,7 +877,6 @@ Symfony is the result of the work of many people who made the code better
- ConneXNL
- Aharon Perkel
- Abdul.Mohsen B. A. A
- SpacePossum
- Benoît Burnichon
- Remi Collet
- pthompson
@ -1059,6 +1065,7 @@ Symfony is the result of the work of many people who made the code better
- stloyd
- Chris Tickner
- Andrew Coulton
- Jeremy Benoist
- Michal Gebauer
- Gleb Sidora
- David Stone
@ -1108,7 +1115,6 @@ Symfony is the result of the work of many people who made the code better
- Simon Sargeant
- efeen
- Michał Dąbrowski (defrag)
- Nathanael Noblet (gnat)
- Simone Fumagalli (hpatoio)
- Brian Graham (incognito)
- Kevin Vergauwen (innocenzo)
@ -1214,8 +1220,10 @@ Symfony is the result of the work of many people who made the code better
- Alan Chen
- Maerlyn
- Even André Fiskvik
- Erik van Wingerden
- Dane Powell
- Gerrit Drost
- Linnaea Von Lavia
- Lenar Lõhmus
- Cristian Gonzalez
- AlberT
@ -1271,6 +1279,7 @@ Symfony is the result of the work of many people who made the code better
- Joseph Deray
- Damian Sromek
- Ben
- dasmfm
- Arnaud Buathier (arnapou)
- chesteroni (chesteroni)
- Mauricio Lopez (diaspar)
@ -1358,7 +1367,6 @@ Symfony is the result of the work of many people who made the code better
- Norman Soetbeer
- zorn
- Benjamin Long
- Robin Chalas
- Matt Janssen
- Peter Gribanov
- kwiateusz
@ -1443,6 +1451,7 @@ Symfony is the result of the work of many people who made the code better
- ollie harridge (ollietb)
- Paul Andrieux (paulandrieux)
- Paweł Szczepanek (pauluz)
- Philippe Degeeter (pdegeeter)
- Christian López Espínola (penyaskito)
- Petr Jaroš (petajaros)
- Philipp Hoffmann (philipphoffmann)

View File

@ -77,6 +77,9 @@ class DelegatingLoader extends BaseDelegatingLoader
} catch (\Exception $e) {
$this->loading = false;
throw $e;
} catch (\Throwable $e) {
$this->loading = false;
throw $e;
}
$this->loading = false;
@ -85,7 +88,7 @@ class DelegatingLoader extends BaseDelegatingLoader
if ($controller = $route->getDefault('_controller')) {
try {
$controller = $this->parser->parse($controller);
} catch (\Exception $e) {
} catch (\InvalidArgumentException $e) {
// unable to optimize unknown notation
}

View File

@ -113,6 +113,9 @@ abstract class FileLoader extends Loader
} catch (\Exception $e) {
unset(self::$loading[$resource]);
throw $e;
} catch (\Throwable $e) {
unset(self::$loading[$resource]);
throw $e;
}
unset(self::$loading[$resource]);

View File

@ -313,6 +313,11 @@ class Container implements IntrospectableContainerInterface
return;
}
throw $e;
} catch (\Throwable $e) {
unset($this->loading[$id]);
unset($this->services[$id]);
throw $e;
}

View File

@ -461,6 +461,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return;
}
throw $e;
} catch (\Throwable $e) {
unset($this->loading[$id]);
throw $e;
}

View File

@ -1268,7 +1268,7 @@ EOF;
return true;
}
if ($deep && !isset($visited[$argumentId])) {
if ($deep && !isset($visited[$argumentId]) && 'service_container' !== (string) $argument) {
$visited[$argumentId] = true;
$service = $this->container->getDefinition($argumentId);

View File

@ -256,4 +256,15 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase
$dumper = new PhpDumper($container);
$dumper->dump();
}
public function testInlinedDefinitionReferencingServiceContainer()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')->addMethodCall('add', array(new Reference('service_container')))->setPublic(false);
$container->register('bar', 'stdClass')->addArgument(new Reference('foo'));
$container->compile();
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container');
}
}

View File

@ -0,0 +1,54 @@
<?php
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
/**
* ProjectServiceContainer.
*
* This class has been auto-generated
* by the Symfony Dependency Injection Component.
*/
class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
/**
* Constructor.
*/
public function __construct()
{
$this->services =
$this->scopedServices =
$this->scopeStacks = array();
$this->scopes = array();
$this->scopeChildren = array();
$this->methodMap = array(
'bar' => 'getBarService',
);
$this->aliases = array();
}
/**
* Gets the 'bar' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return \stdClass A stdClass instance.
*/
protected function getBarService()
{
$a = new \stdClass();
$a->add($this);
return $this->services['bar'] = new \stdClass($a);
}
}

View File

@ -126,7 +126,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
try {
// read timestamp into DateTime object - the formatter delivers in UTC
$dateTime = new \DateTime(sprintf('@%s UTC', $timestamp));
$dateTime = new \DateTime(sprintf('@%s', $timestamp));
} catch (\Exception $e) {
throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
}

View File

@ -71,6 +71,11 @@ class ContainerAwareHttpKernel extends HttpKernel
$this->container->set('request', null, 'request');
$this->container->leaveScope('request');
throw $e;
} catch (\Throwable $e) {
$this->container->set('request', null, 'request');
$this->container->leaveScope('request');
throw $e;
}

View File

@ -59,7 +59,7 @@ class ChainDecoder implements DecoderInterface
*
* @return DecoderInterface
*
* @throws RuntimeException if no decoder is found
* @throws RuntimeException If no decoder is found.
*/
private function getDecoder($format)
{

View File

@ -460,6 +460,8 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
* @param \DOMNode $node
* @param mixed $val
*
* @throws UnexpectedValueException
*
* @return bool
*/
private function selectNodeType(\DOMNode $node, $val)

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/**
* Defines the most basic interface a class must implement to be denormalizable.
*
@ -33,6 +35,10 @@ interface DenormalizableInterface
* @param string|null $format The format is optionally given to be able to denormalize differently
* based on different input formats
* @param array $context options for denormalizing
*
* @return object
*
* @throws Exception
*/
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array());
}

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/**
* Defines the interface of denormalizers.
*
@ -26,6 +28,8 @@ interface DenormalizerInterface
* @param string $format format the given data was extracted from
* @param array $context options available to the denormalizer
*
* @throws Exception
*
* @return object
*/
public function denormalize($data, $class, $format = null, array $context = array());

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/**
* Defines the most basic interface a class must implement to be normalizable.
*
@ -33,6 +35,8 @@ interface NormalizableInterface
* based on different output formats.
* @param array $context Options for normalizing this object
*
* @throws Exception
*
* @return array|string|bool|int|float|null
*/
public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array());

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer\Normalizer;
use Symfony\Component\Serializer\Exception\Exception;
/**
* Defines the interface of normalizers.
*
@ -25,6 +27,8 @@ interface NormalizerInterface
* @param string $format format the normalization result will be encoded as
* @param array $context Context options for the normalizer
*
* @throws Exception
*
* @return array|string|bool|int|float|null
*/
public function normalize($object, $format = null, array $context = array());

View File

@ -183,6 +183,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
* @param string $format format name, present to give the option to normalizers to act differently based on formats
*
* @return NormalizerInterface|null
*
* @throws RuntimeException
*/
private function getNormalizer($data, $format)
{
@ -201,6 +203,8 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
* @param string $format format name, present to give the option to normalizers to act differently based on formats
*
* @return DenormalizerInterface|null
*
* @throws RuntimeException
*/
private function getDenormalizer($data, $class, $format)
{

View File

@ -11,6 +11,8 @@
namespace Symfony\Component\Serializer;
use Symfony\Component\Serializer\Exception\Exception;
/**
* Defines the interface of the Serializer.
*
@ -25,6 +27,8 @@ interface SerializerInterface
* @param string $format format name
* @param array $context options normalizers/encoders have access to
*
* @throws Exception
*
* @return string
*/
public function serialize($data, $format, array $context = array());
@ -37,6 +41,8 @@ interface SerializerInterface
* @param string $format
* @param array $context
*
* @throws Exception
*
* @return object
*/
public function deserialize($data, $type, $format, array $context = array());

View File

@ -58,7 +58,7 @@ class Dumper
if ($inline <= 0 || !is_array($input) || empty($input)) {
$output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport);
} else {
$isAHash = array_keys($input) !== range(0, count($input) - 1);
$isAHash = Inline::isHash($input);
foreach ($input as $key => $value) {
$willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value);

View File

@ -157,6 +157,28 @@ class Inline
}
}
/**
* Check if given array is hash or just normal indexed array.
*
* @internal
*
* @param array $value The PHP array to check
*
* @return bool true if value is hash array, false otherwise
*/
public static function isHash(array $value)
{
$expectedKey = 0;
foreach ($value as $key => $val) {
if ($key !== $expectedKey++) {
return true;
}
}
return false;
}
/**
* Dumps a PHP array to a YAML string.
*
@ -169,11 +191,7 @@ class Inline
private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport)
{
// array
$keys = array_keys($value);
$keysCount = count($keys);
if ((1 === $keysCount && '0' == $keys[0])
|| ($keysCount > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) === $keysCount * ($keysCount - 1) / 2)
) {
if ($value && !self::isHash($value)) {
$output = array();
foreach ($value as $val) {
$output[] = self::dump($val, $exceptionOnInvalidType, $objectSupport);
@ -182,7 +200,7 @@ class Inline
return sprintf('[%s]', implode(', ', $output));
}
// mapping
// hash
$output = array();
foreach ($value as $key => $val) {
$output[] = sprintf('%s: %s', self::dump($key, $exceptionOnInvalidType, $objectSupport), self::dump($val, $exceptionOnInvalidType, $objectSupport));

View File

@ -173,6 +173,24 @@ class InlineTest extends \PHPUnit_Framework_TestCase
Inline::parse('{ foo: * #foo }');
}
/**
* @dataProvider getDataForIsHash
*/
public function testIsHash($array, $expected)
{
$this->assertSame($expected, Inline::isHash($array));
}
public function getDataForIsHash()
{
return array(
array(array(), false),
array(array(1, 2, 3), false),
array(array(2 => 1, 1 => 2, 0 => 3), true),
array(array('foo' => 1, 'bar' => 2), true),
);
}
public function getTestsForParse()
{
return array(
@ -379,6 +397,10 @@ class InlineTest extends \PHPUnit_Framework_TestCase
array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
);
}
}