Merge branch '3.3' into 3.4

* 3.3: (21 commits)
  [appveyor] disable memory limit on composer up
  Remove some unused variables and properties
  Remove some unused variables, properties and methods
  fix some edge cases with indented blocks
  [ExpressionLanguage] Fix parse error on 5.3
  [HttpKernel] remove noisy frame in controller stack traces
  [DI] Fix circular-aliases message
  [ExpressionLanguage] throw an SyntaxError instead of letting a undefined index notice
  Prevent a loop in aliases within the `findDefinition` method
  Fix php doc in Table class
  bumped Symfony version to 3.3.15
  updated VERSION for 3.3.14
  updated CHANGELOG for 3.3.14
  bumped Symfony version to 2.8.33
  updated VERSION for 2.8.32
  updated CHANGELOG for 2.8.32
  bumped Symfony version to 2.7.40
  updated VERSION for 2.7.39
  update CONTRIBUTORS for 2.7.39
  updated CHANGELOG for 2.7.39
  ...
This commit is contained in:
Nicolas Grekas 2017-12-08 16:24:53 +01:00
commit e9f7461ba9
27 changed files with 247 additions and 66 deletions

View File

@ -7,6 +7,41 @@ in 3.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/v3.3.0...v3.3.1
* 3.3.14 (2017-12-04)
* bug #25304 [Bridge/PhpUnit] Prefer $_SERVER['argv'] over $argv (ricknox)
* bug #25308 [FrameworkBundle] Fix a bug where a color tag will be shown when passing an antislash (Simperfit)
* bug #25278 Fix for missing whitespace control modifier in form layout (kubawerlos)
* bug #25305 [Form][TwigBridge] Fix collision between view properties and form fields (yceruto)
* bug #25236 [Form][TwigBridge] Fix collision between view properties and form fields (yceruto)
* bug #25312 [DI] Fix deep-inlining of non-shared refs (nicolas-grekas)
* bug #25309 [Yaml] parse newlines in quoted multiline strings (xabbuh)
* bug #25241 [Yaml] do not eagerly filter comment lines (xabbuh)
* bug #25258 [link] Prevent warnings when running link with 2.7 (dunglas)
* bug #24750 [Validator] ExpressionValidator should use OBJECT_TO_STRING (Simperfit)
* bug #25232 [WebProfilerBundle] [TwigBundle] Fix Profiler breaking XHTML pages (tistre)
* bug #25209 [VarDumper] Dont use empty(), it chokes on eg GMP objects (nicolas-grekas)
* bug #25200 [HttpKernel] Arrays with scalar values passed to ESI fragment renderer throw deprecation notice (Simperfit)
* bug #25217 [Dotenv] Changed preg_match flags from null to 0 (deekthesqueak)
* bug #25203 [DI] Fix infinite loop in InlineServiceDefinitionsPass (nicolas-grekas)
* bug #25185 [Serializer] Do not cache attributes if `attributes` in context (sroze)
* bug #25182 [HttpFoundation] AutExpireFlashBag should not clear new flashes (Simperfit, sroze)
* bug #25179 [FrameworkBundle][Serializer] Remove YamlEncoder definition if Yaml component isn't installed (ogizanagi)
* bug #25163 [DI] Fix tracking of env vars in exceptions (nicolas-grekas)
* bug #25152 [Form] Don't rely on `Symfony\Component\HttpFoundation\File\File` if http-foundation isn't in FileType (issei-m)
* bug #24987 [Console] Fix global console flag when used in chain (Simperfit)
* bug #25146 [DI] Dont resolve envs in service ids (nicolas-grekas)
* bug #25113 [Routing] Fix "config-file-relative" annotation loader resources (nicolas-grekas, sroze)
* bug #25109 Make debug:container search command case-insensitive (jzawadzki)
* bug #25043 [Yaml] added ability for substitute aliases when mapping is on single line (Michał Strzelecki, xabbuh)
* bug #25102 [Form] Fixed ContextErrorException in FileType (chihiro-adachi)
* bug #25130 [DI] Fix handling of inlined definitions by ContainerBuilder (nicolas-grekas)
* bug #25094 [FrameworkBundle][DX] Display a nice error message if an enabled component is missing (derrabus)
* bug #25097 [Bridge\PhpUnit] Turn "preserveGlobalState" to false by default, revert "Blacklist" removal (nicolas-grekas)
* bug #25072 [Bridge/PhpUnit] Remove trailing "\n" from ClockMock::microtime(false) (joky)
* bug #25032 [Bridge\PhpUnit] Disable broken auto-require mechanism of phpunit (nicolas-grekas)
* bug #24956 Fix ambiguous pattern (weltling)
* 3.3.13 (2017-11-16)
* security #24995 Validate redirect targets using the session cookie domain (nicolas-grekas)

View File

@ -14,8 +14,8 @@ Symfony is the result of the work of many people who made the code better
- Victor Berchet (victor)
- Johannes S (johannes)
- Jakub Zalas (jakubzalas)
- Kris Wallsmith (kriswallsmith)
- Kévin Dunglas (dunglas)
- Kris Wallsmith (kriswallsmith)
- Ryan Weaver (weaverryan)
- Javier Eguiluz (javier.eguiluz)
- Maxime Steinhausser (ogizanagi)
@ -29,8 +29,8 @@ Symfony is the result of the work of many people who made the code better
- Joseph Bielawski (stloyd)
- Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith)
- Martin Hasoň (hason)
- Roland Franssen (ro0)
- Martin Hasoň (hason)
- Jeremy Mikola (jmikola)
- Jean-François Simon (jfsimon)
- Benjamin Eberlei (beberlei)
@ -52,24 +52,24 @@ Symfony is the result of the work of many people who made the code better
- Peter Rehm (rpet)
- Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn)
- Yonel Ceruto (yonelceruto)
- Miha Vrhovnik
- Matthias Pigulla (mpdude)
- Diego Saint Esteben (dii3g0)
- Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni)
- Yonel Ceruto (yonelceruto)
- Dany Maillard (maidmaid)
- Kevin Bond (kbond)
- Dany Maillard (maidmaid)
- Pierre du Plessis (pierredup)
- Florin Patan (florinpatan)
- Jérémy DERUSSÉ (jderusse)
- Pierre du Plessis (pierredup)
- Gábor Egyed (1ed)
- Michel Weimerskirch (mweimerskirch)
- Andrej Hudec (pulzarraider)
- Alexander M. Turek (derrabus)
- Eric Clemmons (ericclemmons)
- Jáchym Toušek (enumag)
- Charles Sarrazin (csarrazi)
- Alexander M. Turek (derrabus)
- Konstantin Myakshin (koc)
- Christian Raue
- Arnout Boks (aboks)
@ -79,6 +79,7 @@ Symfony is the result of the work of many people who made the code better
- Titouan Galopin (tgalopin)
- Douglas Greenshields (shieldo)
- Tobias Nyholm (tobias)
- Issei Murasawa (issei_m)
- Lee McDermott
- Brandon Turner
- Luis Cordova (cordoval)
@ -91,13 +92,14 @@ Symfony is the result of the work of many people who made the code better
- John Wards (johnwards)
- Dariusz Ruminski
- Fran Moreno (franmomu)
- Issei Murasawa (issei_m)
- Antoine Hérault (herzult)
- Paráda József (paradajozsef)
- Arnaud Le Blanc (arnaud-lb)
- Maxime STEINHAUSSER
- Michal Piotrowski (eventhorizon)
- Samuel ROZE (sroze)
- Tim Nagel (merk)
- Amrouche Hamza (simperfit)
- Brice BERNARD (brikou)
- Baptiste Clavié (talus)
- Vladimir Reznichenko (kalessil)
@ -126,6 +128,7 @@ Symfony is the result of the work of many people who made the code better
- Sebastiaan Stok (sstok)
- Stefano Sala (stefano.sala)
- Evgeniy (ewgraf)
- Grégoire Paris (greg0ire)
- Vincent AUBERT (vincent)
- Juti Noppornpitak (shiroyuki)
- Tigran Azatyan (tigranazatyan)
@ -135,7 +138,6 @@ Symfony is the result of the work of many people who made the code better
- Guilherme Blanco (guilhermeblanco)
- Pablo Godel (pgodel)
- Jérémie Augustin (jaugustin)
- Grégoire Paris (greg0ire)
- Andréia Bohner (andreia)
- Rafael Dohms (rdohms)
- Arnaud Kleinpeter (nanocom)
@ -149,6 +151,7 @@ Symfony is the result of the work of many people who made the code better
- Vyacheslav Pavlov
- Richard van Laak (rvanlaak)
- Javier Spagnoletti (phansys)
- Julien Falque (julienfalque)
- Richard Shank (iampersistent)
- Thomas Rabaix (rande)
- Rouven Weßling (realityking)
@ -160,7 +163,6 @@ Symfony is the result of the work of many people who made the code better
- Matthieu Ouellette-Vachon (maoueh)
- Michał Pipa (michal.pipa)
- Dawid Nowak
- Julien Falque (julienfalque)
- Amal Raghav (kertz)
- Jonathan Ingram (jonathaningram)
- Artur Kotyrba
@ -171,8 +173,6 @@ Symfony is the result of the work of many people who made the code better
- Warnar Boekkooi (boekkooi)
- Dmitrii Chekaliuk (lazyhammer)
- Clément JOBEILI (dator)
- Amrouche Hamza
- Samuel ROZE (sroze)
- Daniel Espendiller
- Possum
- Dorian Villet (gnutix)
@ -190,6 +190,7 @@ Symfony is the result of the work of many people who made the code better
- Stepan Anchugov (kix)
- bronze1man
- sun (sun)
- Valentin Udaltsov (vudaltsov)
- Larry Garfield (crell)
- Martin Schuhfuß (usefulthink)
- apetitpa
@ -248,7 +249,6 @@ Symfony is the result of the work of many people who made the code better
- Pierre-Yves LEBECQ (pylebecq)
- Jordan Samouh (jordansamouh)
- Jakub Kucharovic (jkucharovic)
- Valentin Udaltsov (vudaltsov)
- Uwe Jäger (uwej711)
- Eugene Leonovich (rybakit)
- Filippo Tessarotto
@ -261,6 +261,7 @@ Symfony is the result of the work of many people who made the code better
- Nikolay Labinskiy (e-moe)
- Leo Feyer
- Chekote
- gadelat (gadelat)
- Thomas Adam
- Albert Casademont (acasademont)
- Jhonny Lidfors (jhonne)
@ -299,8 +300,8 @@ Symfony is the result of the work of many people who made the code better
- Thomas Tourlourat (armetiz)
- Andrey Esaulov (andremaha)
- Grégoire Passault (gregwar)
- Jerzy Zawadzki (jzawadzki)
- Ismael Ambrosi (iambrosi)
- gadelat (gadelat)
- Baptiste Lafontaine
- Aurelijus Valeiša (aurelijus)
- Victor Bocharsky (bocharsky_bw)
@ -345,6 +346,7 @@ Symfony is the result of the work of many people who made the code better
- Yaroslav Kiliba
- Terje Bråten
- Robbert Klarenbeek (robbertkl)
- Edi Modrić (emodric)
- Thomas Calvet (fancyweb)
- Niels Keurentjes (curry684)
- JhonnyL
@ -364,7 +366,6 @@ Symfony is the result of the work of many people who made the code better
- Loïc Chardonnet (gnusat)
- Marek Kalnik (marekkalnik)
- Vyacheslav Salakhutdinov (megazoll)
- Jerzy Zawadzki (jzawadzki)
- Hassan Amouhzi
- Tamas Szijarto
- Pavel Volokitin (pvolok)
@ -375,6 +376,7 @@ Symfony is the result of the work of many people who made the code better
- Tobias Naumann (tna)
- Daniel Beyer
- Shein Alexey
- Alex Rock Ancelet (pierstoval)
- Romain Gautier (mykiwi)
- Joe Lencioni
- Daniel Tschinder
@ -434,7 +436,6 @@ Symfony is the result of the work of many people who made the code better
- cedric lombardot (cedriclombardot)
- Jonas Flodén (flojon)
- Thomas Perez (scullwm)
- Edi Modrić (emodric)
- Marcin Sikoń (marphi)
- Dominik Zogg (dominik.zogg)
- Marek Pietrzak
@ -446,6 +447,7 @@ Symfony is the result of the work of many people who made the code better
- Rob Bast
- Zander Baldwin
- Adam Harvey
- Anton Bakai
- Maxime Veber (nek-)
- Alex Bakhturin
- Yanick Witschi (toflar)
@ -495,7 +497,6 @@ Symfony is the result of the work of many people who made the code better
- Arjen van der Meijden
- Michele Locati
- Dariusz Ruminski
- Alex Rock Ancelet (pierstoval)
- Erik Trapman (eriktrapman)
- De Cock Xavier (xdecock)
- Almog Baku (almogbaku)
@ -619,7 +620,6 @@ Symfony is the result of the work of many people who made the code better
- Catalin Dan
- Stephan Vock
- Benjamin Zikarsky (bzikarsky)
- Anton Bakai
- Simon Schick (simonsimcity)
- redstar504
- Tristan Roussel
@ -711,8 +711,10 @@ Symfony is the result of the work of many people who made the code better
- Nikita Nefedov (nikita2206)
- cgonzalez
- Ben
- Mathieu Lechat
- Vincent Composieux (eko)
- Jayson Xu (superjavason)
- Christopher Hertel (chertel)
- Hubert Lenoir (hubert_lenoir)
- Jaik Dean (jaikdean)
- fago
@ -733,6 +735,7 @@ Symfony is the result of the work of many people who made the code better
- Pierre Vanliefland (pvanliefland)
- Sofiane HADDAG (sofhad)
- frost-nzcr4
- Bozhidar Hristov
- Abhoryo
- Fabian Vogler (fabian)
- Korvin Szanto
@ -763,6 +766,7 @@ Symfony is the result of the work of many people who made the code better
- Fabien LUCAS (flucas2)
- Jörn Lang (j.lang)
- Omar Yepez (oyepez003)
- Gawain Lynch (gawain)
- mwsaz
- Jelle Kapitein
- Benoît Bourgeois
@ -925,6 +929,7 @@ Symfony is the result of the work of many people who made the code better
- Christian
- Denis Golubovskiy (bukashk0zzz)
- Sergii Smertin (nfx)
- Michał Strzelecki
- hugofonseca (fonsecas72)
- Martynas Narbutas
- Bailey Parker
@ -1002,6 +1007,7 @@ Symfony is the result of the work of many people who made the code better
- Brooks Boyd
- Roger Webb
- Dmitriy Simushev
- pkowalczyk
- Max Voloshin (maxvoloshin)
- Nicolas Fabre (nfabre)
- Raul Rodriguez (raul782)
@ -1127,6 +1133,7 @@ Symfony is the result of the work of many people who made the code better
- Max Summe
- WedgeSama
- Felds Liscia
- Chihiro Adachi (chihiro-adachi)
- Sullivan SENECHAL
- Tadcka
- Beth Binkovitz
@ -1283,6 +1290,7 @@ Symfony is the result of the work of many people who made the code better
- nuncanada
- flack
- František Bereň
- Jeremiah VALERIE
- Mike Francis
- Christoph Nissle (derstoffel)
- Ionel Scutelnicu (ionelscutelnicu)
@ -1305,6 +1313,7 @@ Symfony is the result of the work of many people who made the code better
- Andrew Zhilin (zhil)
- Oleksii Zhurbytskyi
- Andy Stanberry
- Felix Marezki
- Luiz “Felds” Liscia
- Thomas Rothe
- nietonfir
@ -1352,7 +1361,6 @@ Symfony is the result of the work of many people who made the code better
- Nicole Cordes
- Martin Kirilov
- Bram Van der Sype (brammm)
- Christopher Hertel (chertel)
- Guile (guile)
- Julien Moulin (lizjulien)
- Mauro Foti (skler)
@ -1386,7 +1394,6 @@ Symfony is the result of the work of many people who made the code better
- Bertalan Attila
- Yannick Bensacq (cibou)
- Freek Van der Herten (freekmurze)
- Gawain Lynch (gawain)
- Luca Genuzio (genuzio)
- Hans Nilsson (hansnilsson)
- Andrew Marcinkevičius (ifdattic)
@ -1444,6 +1451,7 @@ Symfony is the result of the work of many people who made the code better
- David Windell
- Gabriel Birke
- skafandri
- Derek Bonner
- Alan Chen
- Maerlyn
- Even André Fiskvik
@ -1487,6 +1495,7 @@ Symfony is the result of the work of many people who made the code better
- Ian Jenkins (jenkoian)
- Jorge Martin (jorgemartind)
- Joeri Verdeyen (jverdeyen)
- Dmitrii Poddubnyi (karser)
- Kevin Verschaeve (keversc)
- Kevin Herrera (kherge)
- Luis Ramón López López (lrlopez)
@ -1500,6 +1509,7 @@ Symfony is the result of the work of many people who made the code better
- Jimmy Leger (redpanda)
- Marcin Szepczynski (szepczynski)
- Cyrille Jouineau (tuxosaurus)
- Vladimir Chernyshev (volch)
- Yorkie Chadwick (yorkie76)
- GuillaumeVerdon
- Ondrej Mirtes
@ -1582,9 +1592,11 @@ Symfony is the result of the work of many people who made the code better
- Michael Schneider
- Cédric Bertolini
- n-aleha
- Anatol Belski
- Şəhriyar İmanov
- Kaipi Yann
- Sam Williams
- Guillaume Aveline
- Adrian Philipp
- James Michael DuPont
- Kasperki
@ -1744,6 +1756,7 @@ Symfony is the result of the work of many people who made the code better
- Schuyler Jager (sjager)
- Pascal Luna (skalpa)
- Volker (skydiablo)
- Serkan Yildiz (srknyldz)
- Julien Sanchez (sumbobyboys)
- Guillermo Gisinger (t3chn0r)
- Markus Tacker (tacker)

View File

@ -51,7 +51,7 @@ install:
- copy /Y .composer\* %APPDATA%\Composer\
- php .github/build-packages.php "HEAD^" src\Symfony\Bridge\PhpUnit
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
- php composer.phar update --no-progress --no-suggest --ansi
- php -dmemory_limit=-1 composer.phar update --no-progress --no-suggest --ansi
- php phpunit install
test_script:

View File

@ -112,7 +112,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
}
$instance['event'] = array($instance['event']);
if ($lazy = !empty($instance['lazy'])) {
if (!empty($instance['lazy'])) {
$this->container->getDefinition($id)->setPublic(true);
}
}

View File

@ -263,6 +263,7 @@ class Table
* Renders table to output.
*
* Example:
* <code>
* +---------------+-----------------------+------------------+
* | ISBN | Title | Author |
* +---------------+-----------------------+------------------+
@ -270,6 +271,7 @@ class Table
* | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
* | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
* +---------------+-----------------------+------------------+
* </code>
*/
public function render()
{
@ -303,7 +305,7 @@ class Table
/**
* Renders horizontal header separator.
*
* Example: +-----+-----------+-------+
* Example: <code>+-----+-----------+-------+</code>
*/
private function renderRowSeparator()
{
@ -334,7 +336,7 @@ class Table
/**
* Renders table row.
*
* Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
* Example: <code>| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |</code>
*
* @param array $row
* @param string $cellFormat

View File

@ -31,11 +31,6 @@ class TokenStream
*/
private $tokens = array();
/**
* @var bool
*/
private $frozen = false;
/**
* @var Token[]
*/
@ -49,7 +44,7 @@ class TokenStream
/**
* @var Token|null
*/
private $peeked = null;
private $peeked;
/**
* @var bool
@ -75,8 +70,6 @@ class TokenStream
*/
public function freeze()
{
$this->frozen = true;
return $this;
}

View File

@ -33,7 +33,6 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements Repe
{
private $graph;
private $currentDefinition;
private $repeatedPass;
private $onlyConstructorArguments;
private $lazy;
private $expressionLanguage;
@ -51,7 +50,7 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements Repe
*/
public function setRepeatedPass(RepeatedPass $repeatedPass)
{
$this->repeatedPass = $repeatedPass;
// no-op for BC
}
/**

View File

@ -23,7 +23,6 @@ use Symfony\Component\DependencyInjection\Reference;
*/
class InlineServiceDefinitionsPass extends AbstractRecursivePass implements RepeatablePassInterface
{
private $repeatedPass;
private $cloningIds = array();
private $inlinedServiceIds = array();
@ -32,7 +31,7 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe
*/
public function setRepeatedPass(RepeatedPass $repeatedPass)
{
$this->repeatedPass = $repeatedPass;
// no-op for BC
}
/**

View File

@ -1036,8 +1036,19 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
{
$id = $this->normalizeId($id);
$seen = array();
while (isset($this->aliasDefinitions[$id])) {
$id = (string) $this->aliasDefinitions[$id];
if (isset($seen[$id])) {
$seen = array_values($seen);
$seen = array_slice($seen, array_search($id, $seen));
$seen[] = $id;
throw new ServiceCircularReferenceException($id, $seen);
}
$seen[$id] = $id;
}
return $this->getDefinition($id);

View File

@ -1123,6 +1123,23 @@ class ContainerBuilderTest extends TestCase
$this->assertNotSame($bar->foo, $barUser->foo);
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
* @expectedExceptionMessage Circular reference detected for service "app.test_class", path: "app.test_class -> App\TestClass -> app.test_class".
*/
public function testThrowsCircularExceptionForCircularAliases()
{
$builder = new ContainerBuilder();
$builder->setAliases(array(
'foo' => new Alias('app.test_class'),
'app.test_class' => new Alias('App\\TestClass'),
'App\\TestClass' => new Alias('app.test_class'),
));
$builder->findDefinition('foo');
}
public function testInitializePropertiesBeforeMethodCalls()
{
$container = new ContainerBuilder();

View File

@ -112,7 +112,7 @@ final class Dotenv
$this->end = strlen($this->data);
$this->state = self::STATE_VARNAME;
$this->values = array();
$name = $value = '';
$name = '';
$this->skipEmptyLines();

View File

@ -78,7 +78,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
$this->lazyLoad($eventName);
if (isset($this->listenerIds[$eventName])) {
foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method, $priority)) {
foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method)) {
$key = $serviceId.'.'.$method;
if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) {
unset($this->listeners[$eventName][$key]);

View File

@ -146,6 +146,16 @@ class ExpressionLanguageTest extends TestCase
$this->assertSame($expected, $result);
}
/**
* @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError
* @expectedExceptionMessage Unexpected end of expression around position 6 for expression `node.`.
*/
public function testParseThrowsInsteadOfNotice()
{
$expressionLanguage = new ExpressionLanguage();
$expressionLanguage->parse('node.', array('node'));
}
public function shortCircuitProviderEvaluate()
{
$object = $this->getMockBuilder('stdClass')->setMethods(array('foo'))->getMock();

View File

@ -50,12 +50,12 @@ class TokenStream
*/
public function next()
{
++$this->position;
if (!isset($this->tokens[$this->position])) {
throw new SyntaxError('Unexpected end of expression', $this->current->cursor, $this->expression);
}
++$this->position;
$this->current = $this->tokens[$this->position];
}

View File

@ -23,20 +23,17 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
class DateIntervalToStringTransformer implements DataTransformerInterface
{
private $format;
private $parseSigned;
/**
* Transforms a \DateInterval instance to a string.
*
* @see \DateInterval::format() for supported formats
*
* @param string $format The date format
* @param bool $parseSigned Whether to parse as a signed interval
* @param string $format The date format
*/
public function __construct($format = 'P%yY%mM%dDT%hH%iM%sS', $parseSigned = false)
public function __construct($format = 'P%yY%mM%dDT%hH%iM%sS')
{
$this->format = $format;
$this->parseSigned = $parseSigned;
}
/**

View File

@ -50,7 +50,7 @@ class RemoveEmptyControllerArgumentLocatorsPass implements CompilerPassInterface
$action = substr(strrchr($controller, ':'), 1);
$id = substr($controller, 0, -1 - strlen($action));
$controllerDef = $container->getDefinition($id);
foreach ($controllerDef->getMethodCalls() as list($method, $args)) {
foreach ($controllerDef->getMethodCalls() as list($method)) {
if (0 === strcasecmp($action, $method)) {
$reason = sprintf('Removing method "%s" of service "%s" from controller candidates: the method is called at instantiation, thus cannot be an action.', $action, $id);
break;

View File

@ -151,7 +151,7 @@ class Store implements StoreInterface
return;
}
list($req, $headers) = $match;
$headers = $match[1];
if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) {
return $this->restoreResponse($headers, $body);
}

View File

@ -150,7 +150,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
$arguments = $event->getArguments();
// call controller
$response = call_user_func_array($controller, $arguments);
$response = \call_user_func_array($controller, $arguments);
// view
if (!$response instanceof Response) {

View File

@ -119,7 +119,7 @@ abstract class AbstractPipes implements PipesInterface
$w = array($this->pipes[0]);
// let's have a look if something changed in streams
if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
if (false === @stream_select($r, $w, $e, 0, 0)) {
return;
}

View File

@ -99,7 +99,7 @@ class UnixPipes extends AbstractPipes
unset($r[0]);
// let's have a look if something changed in streams
if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
if (($r || $w) && false === @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
// if a system call has been interrupted, forget about it, let's try again
// otherwise, an error occurred, let's reset pipes
if (!$this->hasSystemCallBeenInterrupted()) {

View File

@ -24,7 +24,6 @@ class JsonDecode implements DecoderInterface
private $associative;
private $recursionDepth;
private $lastError = JSON_ERROR_NONE;
/**
* Constructs a new JsonDecode instance.
@ -75,7 +74,7 @@ class JsonDecode implements DecoderInterface
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) {
if (JSON_ERROR_NONE !== json_last_error()) {
throw new NotEncodableValueException(json_last_error_msg());
}

View File

@ -21,7 +21,6 @@ use Symfony\Component\Serializer\Exception\NotEncodableValueException;
class JsonEncode implements EncoderInterface
{
private $options;
private $lastError = JSON_ERROR_NONE;
public function __construct($bitmask = 0)
{
@ -39,7 +38,7 @@ class JsonEncode implements EncoderInterface
$encodedJson = json_encode($data, $context['json_encode_options']);
if (JSON_ERROR_NONE !== $this->lastError = json_last_error()) {
if (JSON_ERROR_NONE !== json_last_error()) {
throw new NotEncodableValueException(json_last_error_msg());
}

View File

@ -399,6 +399,8 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
{
if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
$parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
} else {
unset($parentContext[self::ATTRIBUTES]);
}
return $parentContext;

View File

@ -683,6 +683,16 @@ class ObjectNormalizerTest extends TestCase
),
$serializer->normalize($objectDummy, null, $context)
);
$context = array('attributes' => array('foo', 'baz', 'object'));
$this->assertEquals(
array(
'foo' => 'foo',
'baz' => true,
'object' => array('foo' => 'innerFoo', 'bar' => 'innerBar'),
),
$serializer->normalize($objectDummy, null, $context)
);
}
public function testAttributesContextDenormalize()

View File

@ -227,7 +227,6 @@ class ConstraintViolationAssertion
private $parameters = array();
private $invalidValue = 'InvalidValue';
private $propertyPath = 'property.path';
private $translationDomain;
private $plural;
private $code;
private $constraint;
@ -264,7 +263,7 @@ class ConstraintViolationAssertion
public function setTranslationDomain($translationDomain)
{
$this->translationDomain = $translationDomain;
// no-op for BC
return $this;
}

View File

@ -573,7 +573,27 @@ class Parser
}
if (null === $indentation) {
$newIndent = $this->getCurrentLineIndentation();
$newIndent = null;
$movements = 0;
do {
$EOF = false;
// comment-like lines do not influence the indentation depth
if ($this->isCurrentLineComment()) {
$EOF = !$this->moveToNextLine();
if (!$EOF) {
++$movements;
}
} else {
$newIndent = $this->getCurrentLineIndentation();
}
} while (!$EOF && null === $newIndent);
for ($i = 0; $i < $movements; ++$i) {
$this->moveToPreviousLine();
}
$unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem();
@ -587,6 +607,8 @@ class Parser
$data = array();
if ($this->getCurrentLineIndentation() >= $newIndent) {
$data[] = substr($this->currentLine, $newIndent);
} elseif ($this->isCurrentLineComment()) {
$data[] = $this->currentLine;
} else {
$this->moveToPreviousLine();
@ -905,11 +927,15 @@ class Parser
private function isNextLineIndented()
{
$currentIndentation = $this->getCurrentLineIndentation();
$EOF = !$this->moveToNextLine();
$movements = 0;
while (!$EOF && $this->isCurrentLineEmpty()) {
do {
$EOF = !$this->moveToNextLine();
}
if (!$EOF) {
++$movements;
}
} while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()));
if ($EOF) {
return false;
@ -917,7 +943,9 @@ class Parser
$ret = $this->getCurrentLineIndentation() > $currentIndentation;
$this->moveToPreviousLine();
for ($i = 0; $i < $movements; ++$i) {
$this->moveToPreviousLine();
}
return $ret;
}
@ -1006,19 +1034,25 @@ class Parser
private function isNextLineUnIndentedCollection()
{
$currentIndentation = $this->getCurrentLineIndentation();
$notEOF = $this->moveToNextLine();
$movements = 0;
while ($notEOF && $this->isCurrentLineEmpty()) {
$notEOF = $this->moveToNextLine();
}
do {
$EOF = !$this->moveToNextLine();
if (false === $notEOF) {
if (!$EOF) {
++$movements;
}
} while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()));
if ($EOF) {
return false;
}
$ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem();
$this->moveToPreviousLine();
for ($i = 0; $i < $movements; ++$i) {
$this->moveToPreviousLine();
}
return $ret;
}

View File

@ -2090,6 +2090,68 @@ foo: { &foo { a: Steve, <<: *foo} }
EOE;
$this->parser->parse($yaml);
}
/**
* @dataProvider indentedMappingData
*/
public function testParseIndentedMappings($yaml, $expected)
{
$this->assertSame($expected, $this->parser->parse($yaml));
}
public function indentedMappingData()
{
$tests = array();
$yaml = <<<YAML
foo:
- bar: "foobar"
# A comment
baz: "foobaz"
YAML;
$expected = array(
'foo' => array(
array(
'bar' => 'foobar',
'baz' => 'foobaz',
),
),
);
$tests['comment line is first line in indented block'] = array($yaml, $expected);
$yaml = <<<YAML
foo:
- bar:
# comment
baz: [1, 2, 3]
YAML;
$expected = array(
'foo' => array(
array(
'bar' => array(
'baz' => array(1, 2, 3),
),
),
),
);
$tests['mapping value on new line starting with a comment line'] = array($yaml, $expected);
$yaml = <<<YAML
foo:
-
bar: foobar
YAML;
$expected = array(
'foo' => array(
array(
'bar' => 'foobar',
),
),
);
$tests['mapping in sequence starting on a new line'] = array($yaml, $expected);
return $tests;
}
}
class B