diff --git a/CHANGELOG-3.2.md b/CHANGELOG-3.2.md index 2d191a0eadb05..9647bde2fc96c 100644 --- a/CHANGELOG-3.2.md +++ b/CHANGELOG-3.2.md @@ -7,6 +7,26 @@ in 3.2 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.2.0...v3.2.1 +* 3.2.4 (2017-02-16) + + * bug #21634 [VarDumper] Added missing persistent stream cast (lyrixx) + * bug #21436 [DependencyInjection] check for circular refs caused by method calls (xabbuh) + * bug #21400 [Serializer] fix upper camel case conversion (see #21399) (markusu49) + * bug #21599 [Console][Table] fixed render when using multiple rowspans. (aitboudad) + * bug #21613 [Process] Permit empty suffix on Windows (Bilge) + * bug #21057 [DI] Auto register extension configuration classes as a resource (ro0NL) + * bug #21607 Improve tracking of environment variables in the case of private services (tgalopin) + * bug #21592 [Validator] property constraints can be added in child classes (angelk, xabbuh) + * bug #21458 [Config] Early return for DirectoryResource (robfrawley) + * bug #21562 [DoctrineBridge] make sure that null can be the invalid value (xabbuh) + * bug #21556 [FrameworkBundle] Wire ArrayCache for annotation reader at bootstrap (nicolas-grekas) + * bug #21584 [WebProfilerBundle] Readd Symfony version status in the toolbar (wouterj) + * bug #21557 [VarDumper] Improve dump of AMQP* Object (lyrixx) + * bug #21579 [Security] LdapUserProvider should not throw an exception if the UID key does not exist in an LDAP entry (csarrazi) + * bug #21552 [FrameworkBundle] Fix annotations cache folder path (akeeman) + * bug #21542 [VarDumper] Fixed dumping of terminated generator (lyrixx) + * bug #21292 Ignore missing 'debug.file_link_formatter' service in Debug bundle (core23) + * 3.2.3 (2017-02-06) * bug #21528 [Cache] Fix class exists checks in PhpArrayAdapter (nicolas-grekas) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f740b56abf6f9..13d68464846b0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -15,8 +15,8 @@ Symfony is the result of the work of many people who made the code better - Johannes S (johannes) - Kris Wallsmith (kriswallsmith) - Jakub Zalas (jakubzalas) - - Ryan Weaver (weaverryan) - Kévin Dunglas (dunglas) + - Ryan Weaver (weaverryan) - Javier Eguiluz (javier.eguiluz) - Hugo Hamon (hhamon) - Abdellatif Ait boudad (aitboudad) @@ -26,16 +26,16 @@ 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) - Grégoire Pineau (lyrixx) + - Martin Hasoň (hason) - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - - Eriksen Costa (eriksencosta) - Maxime Steinhausser (ogizanagi) - - Jules Pietri (heah) + - Eriksen Costa (eriksencosta) - Robin Chalas (chalas_r) + - Jules Pietri (heah) - Sarah Khalil (saro0h) - Jonathan Wage (jwage) - Diego Saint Esteben (dosten) @@ -46,14 +46,14 @@ Symfony is the result of the work of many people who made the code better - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - Bulat Shakirzyanov (avalanche123) + - Ener-Getick (energetick) - Saša Stamenković (umpirsky) - Henrik Bjørnskov (henrikbjorn) - Miha Vrhovnik - - Ener-Getick (energetick) + - Roland Franssen (ro0) - Diego Saint Esteben (dii3g0) - Konstantin Kudryashov (everzet) - Iltar van der Berg (kjarli) - - Roland Franssen (ro0) - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - Peter Rehm (rpet) @@ -69,15 +69,15 @@ Symfony is the result of the work of many people who made the code better - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Douglas Greenshields (shieldo) - Titouan Galopin (tgalopin) + - Douglas Greenshields (shieldo) + - Pierre du Plessis (pierredup) - Konstantin Myakshin (koc) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - Graham Campbell (graham) - Daniel Holmes (dholmes) - - Pierre du Plessis (pierredup) - Toni Uebernickel (havvg) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) @@ -102,18 +102,19 @@ Symfony is the result of the work of many people who made the code better - Alexander Schwenn (xelaris) - Florian Voutzinos (florianv) - Colin Frei + - Jérémy DERUSSÉ (jderusse) - Adrien Brault (adrienbrault) - Joshua Thijssen - Peter Kokot (maastermedia) - excelwebzone - Jacob Dreesen (jdreesen) - - Jérémy DERUSSÉ (jderusse) - Vladimir Reznichenko (kalessil) - Tomáš Votruba (tomas_votruba) + - David Buchmann (dbu) - Fabien Pennequin (fabienpennequin) - Gordon Franke (gimler) + - Tobias Nyholm (tobias) - Eric GELOEN (gelo) - - David Buchmann (dbu) - Tugdual Saunier (tucksaun) - Théo FIDRY (theofidry) - Robert Schönthal (digitalkaoz) @@ -121,20 +122,20 @@ Symfony is the result of the work of many people who made the code better - Stefano Sala (stefano.sala) - Evgeniy (ewgraf) - Juti Noppornpitak (shiroyuki) - - Tobias Nyholm (tobias) - Tigran Azatyan (tigranazatyan) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) - Sebastiaan Stok (sstok) + - Yonel Ceruto González (yonelceruto) - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) - Jérémie Augustin (jaugustin) - Andréia Bohner (andreia) - - Yonel Ceruto González (yonelceruto) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) - jwdeitch + - Mikael Pajunen - Joel Wurtz (brouznouf) - Philipp Wahala (hifi) - Vyacheslav Pavlov @@ -144,7 +145,6 @@ Symfony is the result of the work of many people who made the code better - Vincent AUBERT (vincent) - Rouven Weßling (realityking) - Teoh Han Hui (teohhanhui) - - Mikael Pajunen - Clemens Tolboom - Helmer Aaviksoo - Hiromi Hishida (77web) @@ -165,6 +165,7 @@ Symfony is the result of the work of many people who made the code better - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) - Benjamin Dulau (dbenjamin) + - James Halsall (jaitsu) - Mathieu Lemoine (lemoinem) - Andreas Hucks (meandmymonkey) - Noel Guilbert (noel) @@ -194,10 +195,12 @@ Symfony is the result of the work of many people who made the code better - Sven Paulus (subsven) - Rui Marinho (ruimarinho) - Daniel Espendiller + - SpacePossum - Dawid Nowak - Eugene Wissner - Julien Brochet (mewt) - Tristan Darricau (nicofuma) + - Grégoire Paris (greg0ire) - Sergey Linnik (linniksa) - Michaël Perrin (michael.perrin) - Marcel Beerta (mazen) @@ -215,6 +218,7 @@ Symfony is the result of the work of many people who made the code better - Manuel Reinhard (sprain) - Danny Berger (dpb587) - Jérôme Vasseur + - Adam Prager (padam87) - Roman Marintšenko (inori) - Christian Schmidt - Xavier Montaña Carreras (xmontana) @@ -223,13 +227,12 @@ Symfony is the result of the work of many people who made the code better - Arjen Brouwer (arjenjb) - Katsuhiro OGAWA - Patrick McDougle (patrick-mcdougle) - - James Halsall (jaitsu) - Alif Rachmawadi - Kristen Gilden (kgilden) - - SpacePossum - Pierre-Yves LEBECQ (pylebecq) - Alex Pott - Jakub Kucharovic (jkucharovic) + - Uwe Jäger (uwej711) - Eugene Leonovich (rybakit) - Filippo Tessarotto - Joseph Rouff (rouffj) @@ -237,7 +240,6 @@ Symfony is the result of the work of many people who made the code better - GordonsLondon - Jan Sorgalla (jsor) - Ray - - Grégoire Paris (greg0ire) - Leo Feyer - Chekote - Thomas Adam @@ -245,6 +247,7 @@ Symfony is the result of the work of many people who made the code better - Jhonny Lidfors (jhonne) - Diego Agulló (aeoris) - jdhoek + - Pavel Batanov (scaytrase) - Nikita Konstantinov - Wodor Wodorski - Thomas Lallement (raziel057) @@ -277,7 +280,7 @@ Symfony is the result of the work of many people who made the code better - Andrey Esaulov (andremaha) - Grégoire Passault (gregwar) - Ismael Ambrosi (iambrosi) - - Uwe Jäger (uwej711) + - Baptiste Lafontaine - Aurelijus Valeiša (aurelijus) - Victor Bocharsky (bocharsky_bw) - Jan Decavele (jandc) @@ -286,7 +289,6 @@ Symfony is the result of the work of many people who made the code better - Tiago Ribeiro (fixe) - Hidde Boomsma (hboomsma) - John Bafford (jbafford) - - Pavel Batanov (scaytrase) - Bob den Otter (bopp) - Adrian Rudnik (kreischweide) - Francesc Rosàs (frosas) @@ -307,11 +309,12 @@ Symfony is the result of the work of many people who made the code better - Matthew Lewinski (lewinski) - Magnus Nordlander (magnusnordlander) - alquerci - - Adam Prager (padam87) - Francesco Levorato + - Rob Frawley 2nd (robfrawley) - Vitaliy Zakharov (zakharovvi) - Tobias Sjösten (tobiassjosten) - Gyula Sallai (salla) + - David Maicher (dmaicher) - Inal DJAFAR (inalgnu) - Christian Gärtner (dagardner) - Tomasz Kowalczyk (thunderer) @@ -347,7 +350,7 @@ Symfony is the result of the work of many people who made the code better - Tobias Naumann (tna) - Daniel Beyer - Shein Alexey - - Baptiste Lafontaine + - Romain Gautier (mykiwi) - Joe Lencioni - Daniel Tschinder - Kai @@ -386,6 +389,8 @@ Symfony is the result of the work of many people who made the code better - Mihai Stancu - Olivier Dolbeau (odolbeau) - Jan Rosier (rosier) + - Thomas Royer (cydonia7) + - Josip Kruslin - vagrant - EdgarPE - Florian Pfitzer (marmelatze) @@ -397,9 +402,9 @@ Symfony is the result of the work of many people who made the code better - Ariel Ferrandini (aferrandini) - Dirk Pahl (dirkaholic) - cedric lombardot (cedriclombardot) - - David Maicher (dmaicher) - Jonas Flodén (flojon) - Christian Schmidt + - Amrouche Hamza - Marcin Sikoń (marphi) - Dominik Zogg (dominik.zogg) - Marek Pietrzak @@ -417,6 +422,7 @@ Symfony is the result of the work of many people who made the code better - Fabrice Bernhard (fabriceb) - Jérôme Macias (jeromemacias) - Andrey Astakhov (aast) + - Thomas Calvet - Fabian Lange (codingfabian) - Frank Neff (fneff) - Roman Lapin (memphys) @@ -437,6 +443,7 @@ Symfony is the result of the work of many people who made the code better - Roy Van Ginneken (rvanginneken) - ondrowan - Barry vd. Heuvel (barryvdh) + - Wouter J - Evan S Kaufman (evanskaufman) - mcben - Jérôme Vieilledent (lolautruche) @@ -451,7 +458,9 @@ Symfony is the result of the work of many people who made the code better - Jakub Škvára (jskvara) - Andrew Udvare (audvare) - alexpods + - Arjen van der Meijden - Michele Locati + - Dariusz Ruminski - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) - Almog Baku (almogbaku) @@ -494,6 +503,7 @@ Symfony is the result of the work of many people who made the code better - Benjamin Laugueux (yzalis) - Zach Badgett (zachbadgett) - Aurélien Fredouelle + - Jérôme Parmentier (lctrs) - Pavel Campr (pcampr) - Johnny Robeson (johnny) - Disquedur @@ -517,12 +527,11 @@ Symfony is the result of the work of many people who made the code better - Konstantin S. M. Möllers (ksmmoellers) - Sinan Eldem - Alexandre Dupuy (satchette) - - Rob Frawley 2nd + - Andre Rømcke (andrerom) - Nahuel Cuesta (ncuesta) - Chris Boden (cboden) - Asmir Mustafic (goetas) - Stefan Gehrig (sgehrig) - - Josip Kruslin - Hany el-Kerdany - Wang Jingyu - Åsmund Garfors @@ -551,11 +560,14 @@ Symfony is the result of the work of many people who made the code better - maxime.steinhausser - Stefan Warman - Tristan Maindron (tmaindron) + - Wesley Lancel - Ke WANG (yktd26) - Strate - Miquel Rodríguez Telep (mrtorrent) - Sergey Kolodyazhnyy (skolodyazhnyy) - umpirski + - Denis Brumann (dbrumann) + - Quentin de Longraye (quentinus95) - Chris Heng (gigablah) - Ulumuddin Yunus (joenoez) - Luc Vieillescazes (iamluc) @@ -580,6 +592,7 @@ Symfony is the result of the work of many people who made the code better - Disparity - origaminal - Matteo Beccati (matteobeccati) + - Kevin (oxfouzer) - Paweł Wacławczyk (pwc) - Oleg Zinchenko (cystbear) - Johannes Klauss (cloppy) @@ -592,7 +605,6 @@ Symfony is the result of the work of many people who made the code better - develop - ReenExe - Mark Sonnabaum - - Thomas Royer (cydonia7) - Richard Quadling - jochenvdv - Arturas Smorgun (asarturas) @@ -608,7 +620,6 @@ Symfony is the result of the work of many people who made the code better - Martin Hujer (martinhujer) - Pascal Helfenstein - Baldur Rensch (brensch) - - Thomas Calvet - Vladyslav Petrovych - Alex Xandra Albert Sim - Carson Full @@ -636,9 +647,7 @@ Symfony is the result of the work of many people who made the code better - Marc Morera (mmoreram) - Andrew Hilobok (hilobok) - Christian Soronellas (theunic) - - Romain Gautier (mykiwi) - Yosmany Garcia (yosmanyga) - - Wouter J - Wouter de Wild - Miroslav Sustek - Degory Valentine @@ -673,10 +682,10 @@ Symfony is the result of the work of many people who made the code better - Pierre Vanliefland (pvanliefland) - Sofiane HADDAG (sofhad) - frost-nzcr4 - - Arjen van der Meijden - Abhoryo - Fabian Vogler (fabian) - Korvin Szanto + - Arjan Keeman - Alaattin Kahramanlar (alaattin) - Sergey Zolotov (enleur) - Maksim Kotlyar (makasim) @@ -718,7 +727,6 @@ Symfony is the result of the work of many people who made the code better - Simone Di Maulo (toretto460) - Christian Morgan - Alexander Miehe (engerim) - - Jérôme Parmentier (lctrs) - Morgan Auchede (mauchede) - Don Pinkster - Maksim Muruev @@ -779,8 +787,8 @@ Symfony is the result of the work of many people who made the code better - Pieter - Michael Tibben - Sander Marechal - - Andre Rømcke (andrerom) - Radosław Benkel + - jean pasqualini (darkilliant) - ttomor - Mei Gwilym (meigwilym) - Michael H. Arieli (excelwebzone) @@ -790,12 +798,12 @@ Symfony is the result of the work of many people who made the code better - Sander Coolen (scoolen) - Nicolas Le Goff (nlegoff) - Ben Oman + - Andreas Kleemann - Manuele Menozzi - Anton Babenko (antonbabenko) - Irmantas Šiupšinskas (irmantas) - Danilo Silva - Zachary Tong (polyfractal) - - Amrouche Hamza - Hryhorii Hrebiniuk - Dennis Fridrich (dfridrich) - mcfedr (mcfedr) @@ -809,6 +817,7 @@ Symfony is the result of the work of many people who made the code better - boite - MGDSoft - Vadim Tyukov (vatson) + - David Wolter (davewww) - Sortex - chispita - Wojciech Sznapka @@ -817,6 +826,7 @@ Symfony is the result of the work of many people who made the code better - Máximo Cuadros (mcuadros) - tamirvs - julien.galenski + - Bob van de Vijver - Christian Neff - Per Sandström (per) - Goran Juric @@ -824,7 +834,7 @@ Symfony is the result of the work of many people who made the code better - Nicolas Macherey - Lin Clark - Jeremy David (jeremy.david) - - Denis Brumann (dbrumann) + - Robin Lehrmann (robinlehrmann) - Troy McCabe - Ville Mattila - ilyes kooli @@ -837,6 +847,7 @@ Symfony is the result of the work of many people who made the code better - Sergey Novikov (s12v) - Marcos Quesada (marcos_quesada) - Matthew Vickery (mattvick) + - Angel Koilov (po_taka) - Dan Finnie - Ken Marfilla (marfillaster) - benatespina (benatespina) @@ -934,6 +945,7 @@ Symfony is the result of the work of many people who made the code better - Alberto Aldegheri - heccjj - Alexandre Melard + - Jay Klehr - Sergey Yuferev - Tobias Stöckler - Mario Young @@ -946,6 +958,7 @@ Symfony is the result of the work of many people who made the code better - Xavier Coureau - ConneXNL - Aharon Perkel + - matze - Abdul.Mohsen B. A. A - Benoît Burnichon - pthompson @@ -1024,7 +1037,6 @@ Symfony is the result of the work of many people who made the code better - Ahmed TAILOULOUTE (ahmedtai) - Maxime Veber (nek-) - Sullivan SENECHAL - - Dariusz Ruminski - Tadcka - Beth Binkovitz - Romain Geissler @@ -1046,6 +1058,7 @@ Symfony is the result of the work of many people who made the code better - Rafał Muszyński (rafmus90) - Timothy Anido (xanido) - Rick Prent + - skalpa - Martin Eckhardt - Pieter Jordaan - Damien Tournoud @@ -1094,7 +1107,6 @@ Symfony is the result of the work of many people who made the code better - Mephistofeles - Hoffmann András - Olivier - - Wesley Lancel - pscheit - Zdeněk Drahoš - Dan Harper @@ -1129,6 +1141,7 @@ Symfony is the result of the work of many people who made the code better - Povilas S. (povilas) - pborreli - Eric Caron + - Richard Bradley - 2manypeople - Wing - Thomas Bibb @@ -1187,6 +1200,7 @@ Symfony is the result of the work of many people who made the code better - Andy Stanberry - Luiz “Felds” Liscia - Thomas Rothe + - nietonfir - alefranz - avi123 - alsar @@ -1232,6 +1246,7 @@ Symfony is the result of the work of many people who made the code better - Yannick Warnier (ywarnier) - Kevin Decherf - Jason Woods + - klemens - dened - Dmitry Korotovsky - Michael van Tricht @@ -1247,6 +1262,7 @@ Symfony is the result of the work of many people who made the code better - Andrey Chernykh - Edvinas Klovas - Drew Butler + - Peter Breuls - Tischoi - J Bruni - Alexey Prilipko @@ -1312,6 +1328,7 @@ Symfony is the result of the work of many people who made the code better - Alan Chen - Maerlyn - Even André Fiskvik + - Arjan Keeman - Erik van Wingerden - Dane Powell - Gerrit Drost @@ -1359,6 +1376,7 @@ Symfony is the result of the work of many people who made the code better - Marcin Szepczynski (szepczynski) - Cyrille Jouineau (tuxosaurus) - Yorkie Chadwick (yorkie76) + - GuillaumeVerdon - Yanick Witschi - Ondrej Mirtes - akimsko @@ -1513,6 +1531,7 @@ Symfony is the result of the work of many people who made the code better - Choong Wei Tjeng (choonge) - Kousuke Ebihara (co3k) - Loïc Vernet (coil) + - Christian Gripp (core23) - Christoph Schaefer (cvschaefer) - Damon Jones (damon__jones) - Łukasz Giza (destroyer) @@ -1594,6 +1613,7 @@ Symfony is the result of the work of many people who made the code better - simpson - drublic - Andreas Streichardt + - Pascal Hofmann - smokeybear87 - Gustavo Adrian - Kevin Weber @@ -1616,7 +1636,6 @@ Symfony is the result of the work of many people who made the code better - Muharrem Demirci (mdemirci) - Evgeny Z (meze) - Nicolas de Marqué (nicola) - - Kevin (oxfouzer) - Pierre Geyer (ptheg) - Sam Fleming (sam_fleming) - Thomas BERTRAND (sevrahk) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoubleNullableNameEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoubleNullableNameEntity.php new file mode 100644 index 0000000000000..29b247b9b1c36 --- /dev/null +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/DoubleNullableNameEntity.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Doctrine\Tests\Fixtures; + +use Doctrine\ORM\Mapping\Id; +use Doctrine\ORM\Mapping\Column; +use Doctrine\ORM\Mapping\Entity; + +/** @Entity */ +class DoubleNullableNameEntity +{ + /** @Id @Column(type="integer") */ + protected $id; + + /** @Column(type="string", nullable=true) */ + public $name; + + /** @Column(type="string", nullable=true) */ + public $name2; + + public function __construct($id, $name, $name2) + { + $this->id = $id; + $this->name = $name; + $this->name2 = $name2; + } +} diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 2881ed5f723e2..aa2ecc7a3a485 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -22,6 +22,7 @@ use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity; +use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNullableNameEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2; use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity; @@ -142,6 +143,7 @@ private function createSchema(ObjectManager $em) $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity'), + $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNullableNameEntity'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2'), @@ -231,7 +233,7 @@ public function testValidateUniquenessWithNull() $this->assertNoViolation(); } - public function testValidateUniquenessWithIgnoreNull() + public function testValidateUniquenessWithIgnoreNullDisabled() { $constraint = new UniqueEntity(array( 'message' => 'myMessage', @@ -281,6 +283,34 @@ public function testAllConfiguredFieldsAreCheckedOfBeingMappedByDoctrineWithIgno $this->validator->validate($entity1, $constraint); } + public function testNoValidationIfFirstFieldIsNullAndNullValuesAreIgnored() + { + $constraint = new UniqueEntity(array( + 'message' => 'myMessage', + 'fields' => array('name', 'name2'), + 'em' => self::EM_NAME, + 'ignoreNull' => true, + )); + + $entity1 = new DoubleNullableNameEntity(1, null, 'Foo'); + $entity2 = new DoubleNullableNameEntity(2, null, 'Foo'); + + $this->validator->validate($entity1, $constraint); + + $this->assertNoViolation(); + + $this->em->persist($entity1); + $this->em->flush(); + + $this->validator->validate($entity1, $constraint); + + $this->assertNoViolation(); + + $this->validator->validate($entity2, $constraint); + + $this->assertNoViolation(); + } + public function testValidateUniquenessWithValidCustomErrorPath() { $constraint = new UniqueEntity(array( diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index b079770c6b3d6..454111c2387d3 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -81,6 +81,8 @@ public function validate($entity, Constraint $constraint) /* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */ $criteria = array(); + $hasNullValue = false; + foreach ($fields as $fieldName) { if (!$class->hasField($fieldName) && !$class->hasAssociation($fieldName)) { throw new ConstraintDefinitionException(sprintf('The field "%s" is not mapped by Doctrine, so it cannot be validated for uniqueness.', $fieldName)); @@ -88,6 +90,10 @@ public function validate($entity, Constraint $constraint) $fieldValue = $class->reflFields[$fieldName]->getValue($entity); + if (null === $fieldValue) { + $hasNullValue = true; + } + if ($constraint->ignoreNull && null === $fieldValue) { continue; } @@ -103,6 +109,11 @@ public function validate($entity, Constraint $constraint) } } + // validation doesn't fail if one of the fields is null and if null values should be ignored + if ($hasNullValue && $constraint->ignoreNull) { + return; + } + // skip validation if there are no criteria (this can happen when the // "ignoreNull" option is enabled and fields to be checked are null if (empty($criteria)) { diff --git a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php index 7469183e75de1..81cef949c7408 100644 --- a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php @@ -40,11 +40,25 @@ public function getFunctions() ); } + /** + * @param string $name + * @param array $parameters + * @param bool $relative + * + * @return string + */ public function getPath($name, $parameters = array(), $relative = false) { return $this->generator->generate($name, $parameters, $relative ? UrlGeneratorInterface::RELATIVE_PATH : UrlGeneratorInterface::ABSOLUTE_PATH); } + /** + * @param string $name + * @param array $parameters + * @param bool $schemeRelative + * + * @return string + */ public function getUrl($name, $parameters = array(), $schemeRelative = false) { return $this->generator->generate($name, $parameters, $schemeRelative ? UrlGeneratorInterface::NETWORK_PATH : UrlGeneratorInterface::ABSOLUTE_URL); diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php index dc88f172dcdd3..392d2a8784b0e 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php @@ -63,9 +63,7 @@ protected function getFragmentHandler($return) $context->expects($this->any())->method('getCurrentRequest')->will($this->returnValue(Request::create('/'))); - $renderer = new FragmentHandler($context, array($strategy), false); - - return $renderer; + return new FragmentHandler($context, array($strategy), false); } protected function renderTemplate(FragmentHandler $renderer, $template = '{{ render("foo") }}') diff --git a/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml b/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml index 655d0ae5c7e89..ae7d91add15d4 100644 --- a/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml @@ -38,7 +38,7 @@ 0 - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 43771d4f70e52..2e63e6385f534 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -185,7 +185,7 @@ protected function describeContainerDefinition(Definition $definition, array $op ; foreach ($definition->getAutowiringTypes() as $autowiringType) { - $output .= "\n" . '- Autowiring Type: `' . $autowiringType . '`'; + $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; } if ($definition->getFile()) { diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php index 4b75738b2fd1a..508899379f691 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddAnnotationsCachedReaderPass.php @@ -13,6 +13,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; /** * @internal @@ -27,7 +28,16 @@ public function process(ContainerBuilder $container) // "annotations.cached_reader" is wired late so that any passes using // "annotation_reader" at build time don't get any cache if ($container->hasDefinition('annotations.cached_reader')) { - $container->setAlias('annotation_reader', 'annotations.cached_reader'); + $reader = $container->getDefinition('annotations.cached_reader'); + $tags = $reader->getTags(); + + if (isset($tags['annotations.cached_reader'][0]['provider'])) { + if ($container->hasAlias($provider = $tags['annotations.cached_reader'][0]['provider'])) { + $provider = (string) $container->getAlias($provider); + } + $container->set('annotations.cached_reader', null); + $container->setDefinition('annotations.cached_reader', $reader->replaceArgument(1, new Reference($provider))); + } } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 7429eed2f27a0..cfe687ad35916 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -35,7 +35,6 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer; use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer; use Symfony\Component\Workflow; -use Symfony\Component\Yaml\Yaml; /** * FrameworkExtension. @@ -764,23 +763,14 @@ private function createPackageDefinition($basePath, array $baseUrls, Reference $ throw new \LogicException('An asset package cannot have base URLs and base paths.'); } - if (!$baseUrls) { - $package = new DefinitionDecorator('assets.path_package'); - - return $package - ->setPublic(false) - ->replaceArgument(0, $basePath) - ->replaceArgument(1, $version) - ; - } - - $package = new DefinitionDecorator('assets.url_package'); - - return $package + $package = new DefinitionDecorator($baseUrls ? 'assets.url_package' : 'assets.path_package'); + $package ->setPublic(false) - ->replaceArgument(0, $baseUrls) + ->replaceArgument(0, $baseUrls ?: $basePath) ->replaceArgument(1, $version) ; + + return $package; } private function createVersion(ContainerBuilder $container, $version, $format, $name) @@ -1039,10 +1029,11 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde $container ->getDefinition('annotations.cached_reader') - ->replaceArgument(1, new Reference($cacheService)) ->replaceArgument(2, $config['debug']) + ->addTag('annotations.cached_reader', array('provider' => $cacheService)) ->addAutowiringType(Reader::class) ; + $container->setAlias('annotation_reader', 'annotations.cached_reader'); } else { $container->removeDefinition('annotations.cached_reader'); } @@ -1235,7 +1226,6 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild private function registerCacheConfiguration(array $config, ContainerBuilder $container) { $version = substr(str_replace('/', '-', base64_encode(hash('sha256', uniqid(mt_rand(), true), true))), 0, 22); - $container->getDefinition('cache.annotations')->replaceArgument(2, $version); $container->getDefinition('cache.adapter.apcu')->replaceArgument(2, $version); $container->getDefinition('cache.adapter.system')->replaceArgument(2, $version); $container->getDefinition('cache.adapter.filesystem')->replaceArgument(2, $config['directory']); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml index a2a0fb4065329..146a875ad7dc9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml @@ -11,7 +11,9 @@ - + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index c4085e4ec0f93..ba36cbde0c884 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -133,7 +133,7 @@ public function fileExcerpt($file, $line) $code = @highlight_file($file, true); // remove main code/span tags $code = preg_replace('#^\s*(.*)\s*#s', '\\1', $code); - $content = preg_split('#
#', $code); + $content = explode('
', $code); $lines = array(); for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php index 062210d3a0585..74a33f3b43130 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php @@ -35,7 +35,7 @@ class TemplatePathsCacheWarmerTest extends TestCase private $tmpDir; - public function setUp() + protected function setUp() { $this->templateFinder = $this ->getMockBuilder(TemplateFinderInterface::class) @@ -56,7 +56,7 @@ public function setUp() $this->filesystem->mkdir($this->tmpDir); } - public function tearDown() + protected function tearDown() { $this->filesystem->remove($this->tmpDir); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index fec9b4be16ab2..71b5fada8f0f4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection; use Symfony\Bundle\FrameworkBundle\Tests\TestCase; +use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddAnnotationsCachedReaderPass; use Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension; use Symfony\Component\Cache\Adapter\ApcuAdapter; use Symfony\Component\Cache\Adapter\ChainAdapter; @@ -818,6 +819,7 @@ protected function createContainerFromFile($file, $data = array(), $resetCompile $container->getCompilerPassConfig()->setOptimizationPasses(array()); $container->getCompilerPassConfig()->setRemovingPasses(array()); } + $container->getCompilerPassConfig()->setBeforeRemovingPasses(array(new AddAnnotationsCachedReaderPass())); $container->compile(); return self::$containerCache[$cacheKey] = $container; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php index cb3c763f8f3c8..5a7cd354763d0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php @@ -46,4 +46,4 @@ trans('typecast', ['a' => (int) '123'], 'not_messages'); ?> transChoice('msg1', 10 + 1, [], 'not_messages'); ?> -transChoice('msg2', intval(4.5), [], 'not_messages'); ?> +transChoice('msg2', ceil(4.5), [], 'not_messages'); ?> diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php index 9da6601ff547b..6241cf4f3912f 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SimpleFormFactory.php @@ -77,17 +77,4 @@ protected function createListener($container, $id, $config, $userProvider) return $listenerId; } - - protected function createEntryPoint($container, $id, $config, $defaultEntryPoint) - { - $entryPointId = 'security.authentication.form_entry_point.'.$id; - $container - ->setDefinition($entryPointId, new DefinitionDecorator('security.authentication.form_entry_point')) - ->addArgument(new Reference('security.http_utils')) - ->addArgument($config['login_path']) - ->addArgument($config['use_forward']) - ; - - return $entryPointId; - } } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig index 46234cda974dd..d80b3a5507ac4 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig @@ -121,7 +121,7 @@ {% endset %} - {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status, additional_classes: 'sf-toolbar-block-right' }) }} + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status, additional_classes: 'sf-toolbar-block-right', block_attrs: 'title="' ~ symfony_version_status ~ '"' }) }} {% endblock %} {% block menu %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig index d25c5502ae8b0..aef89183cda1d 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig @@ -1,4 +1,4 @@ -
+
{% if link is not defined or link %}{% endif %}
{{ icon|default('') }}
{% if link|default(false) %}
{% endif %} diff --git a/src/Symfony/Component/Config/Resource/DirectoryResource.php b/src/Symfony/Component/Config/Resource/DirectoryResource.php index 120ab43d1937a..434c048b67d95 100644 --- a/src/Symfony/Component/Config/Resource/DirectoryResource.php +++ b/src/Symfony/Component/Config/Resource/DirectoryResource.php @@ -74,7 +74,10 @@ public function isFresh($timestamp) return false; } - $newestMTime = filemtime($this->resource); + if ($timestamp < filemtime($this->resource)) { + return false; + } + foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) { // if regex filtering is enabled only check matching files if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) { @@ -87,10 +90,13 @@ public function isFresh($timestamp) continue; } - $newestMTime = max($file->getMTime(), $newestMTime); + // early return if a file's mtime exceeds the passed timestamp + if ($timestamp < $file->getMTime()) { + return false; + } } - return $newestMTime < $timestamp; + return true; } public function serialize() diff --git a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php index a22209dd84dd9..9d8e055c5450e 100644 --- a/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php @@ -110,8 +110,10 @@ public function testIsFreshNewFileWithDifferentPattern() public function testIsFreshDeleteFile() { $resource = new DirectoryResource($this->directory); + $time = time(); + sleep(1); unlink($this->directory.'/tmp.xml'); - $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if an existing file is removed'); + $this->assertFalse($resource->isFresh($time), '->isFresh() returns false if an existing file is removed'); } public function testIsFreshDeleteDirectory() diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index d7f4cb775138d..fe58bb9fa1fb2 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -39,7 +39,7 @@ class QuestionHelper extends Helper * @param OutputInterface $output An OutputInterface instance * @param Question $question The question to ask * - * @return string The user answer + * @return mixed The user answer * * @throws RuntimeException If there is no data to read in the input stream */ @@ -397,7 +397,7 @@ private function getHiddenResponse(OutputInterface $output, $inputStream) * @param OutputInterface $output An Output instance * @param Question $question A Question instance * - * @return string The validated response + * @return mixed The validated response * * @throws \Exception In case the max number of attempts has been reached and no valid response has been given */ diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 6f784ae78df64..36f3301817aed 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -479,6 +479,9 @@ private function fillNextRows($rows, $line) foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : ''; $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan())); + if ($nbLines === $unmergedRowKey - $line) { + break; + } } } } diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php index 92f358204c450..96433ed5b32d2 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php +++ b/src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_5.php @@ -4,7 +4,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -//Ensure has proper line ending before outputing a text block like with SymfonyStyle::listing() or SymfonyStyle::text() +//Ensure has proper line ending before outputting a text block like with SymfonyStyle::listing() or SymfonyStyle::text() return function (InputInterface $input, OutputInterface $output) { $output = new SymfonyStyle($input, $output); diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index f70d84b591449..7e47c0b09974a 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -298,10 +298,10 @@ public function testRenderProvider() array( array( new TableCell('9971-5-0210-0', array('rowspan' => 3)), - 'Divine Comedy', + new TableCell('Divine Comedy', array('rowspan' => 2)), 'Dante Alighieri', ), - array('A Tale of Two Cities', 'Charles Dickens'), + array(), array("The Lord of \nthe Rings", "J. R. \nR. Tolkien"), new TableSeparator(), array('80-902734-1-6', new TableCell("And Then \nThere \nWere None", array('rowspan' => 3)), 'Agatha Christie'), @@ -309,18 +309,18 @@ public function testRenderProvider() ), 'default', <<<'TABLE' -+---------------+----------------------+-----------------+ -| ISBN | Title | Author | -+---------------+----------------------+-----------------+ -| 9971-5-0210-0 | Divine Comedy | Dante Alighieri | -| | A Tale of Two Cities | Charles Dickens | -| | The Lord of | J. R. | -| | the Rings | R. Tolkien | -+---------------+----------------------+-----------------+ -| 80-902734-1-6 | And Then | Agatha Christie | -| 80-902734-1-7 | There | Test | -| | Were None | | -+---------------+----------------------+-----------------+ ++---------------+---------------+-----------------+ +| ISBN | Title | Author | ++---------------+---------------+-----------------+ +| 9971-5-0210-0 | Divine Comedy | Dante Alighieri | +| | | | +| | The Lord of | J. R. | +| | the Rings | R. Tolkien | ++---------------+---------------+-----------------+ +| 80-902734-1-6 | And Then | Agatha Christie | +| 80-902734-1-7 | There | Test | +| | Were None | | ++---------------+---------------+-----------------+ TABLE ), diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index fcb986383c3de..985f3a50e1392 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -217,26 +217,24 @@ private function set($type, $id) // is this already a type/class that is known to match multiple services? if (isset($this->ambiguousServiceTypes[$type])) { - $this->addServiceToAmbiguousType($id, $type); + $this->ambiguousServiceTypes[$type][] = $id; return; } // check to make sure the type doesn't match multiple services - if (isset($this->types[$type])) { - if ($this->types[$type] === $id) { - return; - } - - // keep an array of all services matching this type - $this->addServiceToAmbiguousType($id, $type); - - unset($this->types[$type]); + if (!isset($this->types[$type]) || $this->types[$type] === $id) { + $this->types[$type] = $id; return; } - $this->types[$type] = $id; + // keep an array of all services matching this type + if (!isset($this->ambiguousServiceTypes[$type])) { + $this->ambiguousServiceTypes[$type] = array($this->types[$type]); + unset($this->types[$type]); + } + $this->ambiguousServiceTypes[$type][] = $id; } /** @@ -311,17 +309,6 @@ private function getReflectionClass($id, Definition $definition) return $this->reflectionClasses[$id] = $reflector; } - private function addServiceToAmbiguousType($id, $type) - { - // keep an array of all services matching this type - if (!isset($this->ambiguousServiceTypes[$type])) { - $this->ambiguousServiceTypes[$type] = array( - $this->types[$type], - ); - } - $this->ambiguousServiceTypes[$type][] = $id; - } - /** * @param \ReflectionClass $reflectionClass * diff --git a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php index f9e6024164c15..9434ac70b543b 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php @@ -12,6 +12,7 @@ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; /** @@ -47,6 +48,9 @@ public function process(ContainerBuilder $container) $tmpContainer = new ContainerBuilder($container->getParameterBag()); $tmpContainer->setResourceTracking($container->isTrackingResources()); $tmpContainer->addObjectResource($extension); + if ($extension instanceof ConfigurationExtensionInterface && null !== $configuration = $extension->getConfiguration($config, $tmpContainer)) { + $tmpContainer->addObjectResource($configuration); + } foreach ($exprLangProviders as $provider) { $tmpContainer->addExpressionLanguageProvider($provider); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php index 9e18a9ebde062..8252f73f6dba1 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php @@ -72,6 +72,7 @@ public function process(ContainerBuilder $container) $compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'replaces alias '.reset($referencingAliases))); } elseif (0 === count($referencingAliases) && false === $isReferenced) { $container->removeDefinition($id); + $container->resolveEnvPlaceholders(serialize($definition)); $compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'unused')); $hasChanged = true; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php index 00fc859d3e72e..85c1cf5474c2e 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -51,7 +51,7 @@ public function process(ContainerBuilder $container) if (isset($replacements[$targetId])) { $container->setAlias($definitionId, $replacements[$targetId]); } - // No neeed to process the same target twice + // No need to process the same target twice if (isset($seenAliasTargets[$targetId])) { continue; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index 8d957d47b5b7e..6ba0b2f48110b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -11,6 +11,9 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler; +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; @@ -48,4 +51,32 @@ public function testExpressionLanguageProviderForwarding() $this->assertEquals(array($provider), $tmpProviders); } + + public function testExtensionConfigurationIsTrackedByDefault() + { + $extension = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Extension\\Extension')->getMock(); + $extension->expects($this->once()) + ->method('getConfiguration') + ->will($this->returnValue(new FooConfiguration())); + $extension->expects($this->any()) + ->method('getAlias') + ->will($this->returnValue('foo')); + + $container = new ContainerBuilder(new ParameterBag()); + $container->registerExtension($extension); + $container->prependExtensionConfig('foo', array('bar' => true)); + + $pass = new MergeExtensionConfigurationPass(); + $pass->process($container); + + $this->assertContains(new FileResource(__FILE__), $container->getResources(), '', false, false); + } +} + +class FooConfiguration implements ConfigurationInterface +{ + public function getConfigTreeBuilder() + { + return new TreeBuilder(); + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php index 82149ebdb3c18..cd51a0b29ac0a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php @@ -14,6 +14,7 @@ use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass; +use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -105,6 +106,28 @@ public function testProcessWontRemovePrivateFactory() $this->assertTrue($container->hasDefinition('foobar')); } + public function testProcessConsiderEnvVariablesAsUsedEvenInPrivateServices() + { + $container = new ContainerBuilder(); + $container->setParameter('env(FOOBAR)', 'test'); + $container + ->register('foo') + ->setArguments(array('%env(FOOBAR)%')) + ->setPublic(false) + ; + + $resolvePass = new ResolveParameterPlaceHoldersPass(); + $resolvePass->process($container); + + $this->process($container); + + $this->assertFalse($container->hasDefinition('foo')); + + $envCounters = $container->getEnvCounters(); + $this->assertArrayHasKey('FOOBAR', $envCounters); + $this->assertSame(1, $envCounters['FOOBAR']); + } + protected function process(ContainerBuilder $container) { $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), new RemoveUnusedDefinitionsPass())); diff --git a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php index 423c5db2ec96a..f81fcf0608964 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php @@ -36,7 +36,7 @@ public function testCrossCheck($fixture, $type) $tmp = tempnam(sys_get_temp_dir(), 'sf'); - file_put_contents($tmp, file_get_contents(self::$fixturesPath.'/'.$type.'/'.$fixture)); + copy(self::$fixturesPath.'/'.$type.'/'.$fixture, $tmp); $container1 = new ContainerBuilder(); $loader1 = new $loaderClass($container1, new FileLocator()); diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php index 825c78fedeb30..0314621907356 100644 --- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -164,7 +164,7 @@ public function setContentDisposition($disposition, $filename = '', $filenameFal if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) { $encoding = mb_detect_encoding($filename, null, true); - for ($i = 0; $i < mb_strlen($filename, $encoding); ++$i) { + for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) { $char = mb_substr($filename, $i, 1, $encoding); if ('%' === $char || ord($char) < 32 || ord($char) > 126) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index eabc51e79fe91..341382ccaff22 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -106,7 +106,7 @@ public function testRead() if (phpversion('mongodb')) { $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$gte']); - $this->assertGreaterThanOrEqual(round(intval((string) $criteria[$this->options['expiry_field']]['$gte']) / 1000), $testTimeout); + $this->assertGreaterThanOrEqual(round(((int) $criteria[$this->options['expiry_field']]['$gte']) / 1000), $testTimeout); } else { $this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$gte']); $this->assertGreaterThanOrEqual($criteria[$this->options['expiry_field']]['$gte']->sec, $testTimeout); @@ -164,7 +164,7 @@ public function testWrite() $this->assertEquals('bar', $data[$this->options['data_field']]->getData()); $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['time_field']]); $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $data[$this->options['expiry_field']]); - $this->assertGreaterThanOrEqual($expectedExpiry, round(intval((string) $data[$this->options['expiry_field']]) / 1000)); + $this->assertGreaterThanOrEqual($expectedExpiry, round(((int) $data[$this->options['expiry_field']]) / 1000)); } else { $this->assertEquals('bar', $data[$this->options['data_field']]->bin); $this->assertInstanceOf('MongoDate', $data[$this->options['time_field']]); @@ -287,7 +287,7 @@ public function testGc() ->will($this->returnCallback(function ($criteria) { if (phpversion('mongodb')) { $this->assertInstanceOf('MongoDB\BSON\UTCDateTime', $criteria[$this->options['expiry_field']]['$lt']); - $this->assertGreaterThanOrEqual(time() - 1, round(intval((string) $criteria[$this->options['expiry_field']]['$lt']) / 1000)); + $this->assertGreaterThanOrEqual(time() - 1, round(((int) $criteria[$this->options['expiry_field']]['$lt']) / 1000)); } else { $this->assertInstanceOf('MongoDate', $criteria[$this->options['expiry_field']]['$lt']); $this->assertGreaterThanOrEqual(time() - 1, $criteria[$this->options['expiry_field']]['$lt']->sec); diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 80b1bd6cd34e7..b1814ad1f3e6b 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -25,6 +25,9 @@ * Client simulates a browser and makes requests to a Kernel object. * * @author Fabien Potencier + * + * @method Request|null getRequest() A Request instance + * @method Response|null getResponse() A Response instance */ class Client extends BaseClient { @@ -47,26 +50,6 @@ public function __construct(HttpKernelInterface $kernel, array $server = array() parent::__construct($server, $history, $cookieJar); } - /** - * {@inheritdoc} - * - * @return Request|null A Request instance - */ - public function getRequest() - { - return parent::getRequest(); - } - - /** - * {@inheritdoc} - * - * @return Response|null A Response instance - */ - public function getResponse() - { - return parent::getResponse(); - } - /** * Makes a request. * diff --git a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php index c505e052a205c..f1e48311c0429 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php @@ -37,7 +37,7 @@ public function exportValue($value, $depth = 1, $deep = false) if (is_object($value)) { if ($value instanceof \DateTimeInterface) { - return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601)); + return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM)); } return sprintf('Object(%s)', get_class($value)); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 6bc132aa2d3c7..137f6f4dfc850 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,11 +58,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '3.2.3'; - const VERSION_ID = 30203; + const VERSION = '3.2.4'; + const VERSION_ID = 30204; const MAJOR_VERSION = 3; const MINOR_VERSION = 2; - const RELEASE_VERSION = 3; + const RELEASE_VERSION = 4; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2017'; diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php index c583918f8c09f..d42b91bde3653 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/Util/ValueExporterTest.php @@ -31,13 +31,13 @@ protected function setUp() public function testDateTime() { $dateTime = new \DateTime('2014-06-10 07:35:40', new \DateTimeZone('UTC')); - $this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime)); + $this->assertSame('Object(DateTime) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime)); } public function testDateTimeImmutable() { $dateTime = new \DateTimeImmutable('2014-06-10 07:35:40', new \DateTimeZone('UTC')); - $this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+0000', $this->valueExporter->exportValue($dateTime)); + $this->assertSame('Object(DateTimeImmutable) - 2014-06-10T07:35:40+00:00', $this->valueExporter->exportValue($dateTime)); } public function testIncompleteClass() diff --git a/src/Symfony/Component/Process/ExecutableFinder.php b/src/Symfony/Component/Process/ExecutableFinder.php index 824457ce2a122..d8e689622a537 100644 --- a/src/Symfony/Component/Process/ExecutableFinder.php +++ b/src/Symfony/Component/Process/ExecutableFinder.php @@ -75,7 +75,7 @@ public function find($name, $default = null, array $extraDirs = array()) $suffixes = array(''); if ('\\' === DIRECTORY_SEPARATOR) { $pathExt = getenv('PATHEXT'); - $suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes; + $suffixes = array_merge($suffixes, $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes); } foreach ($suffixes as $suffix) { foreach ($dirs as $dir) { diff --git a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php index 06baeae7d118f..f42939b68e475 100644 --- a/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php +++ b/src/Symfony/Component/Security/Core/Tests/User/LdapUserProviderTest.php @@ -151,10 +151,7 @@ public function testLoadUserByUsernameFailsIfMoreThanOneLdapPasswordsInEntry() ); } - /** - * @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException - */ - public function testLoadUserByUsernameFailsIfEntryHasNoUidKeyAttribute() + public function testLoadUserByUsernameShouldNotFailIfEntryHasNoUidKeyAttribute() { $result = $this->getMockBuilder(CollectionInterface::class)->getMock(); $query = $this->getMockBuilder(QueryInterface::class)->getMock(); diff --git a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php index 1edf3f764ef04..ffcd148b5f63b 100644 --- a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php +++ b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php @@ -48,7 +48,7 @@ class LdapUserProvider implements UserProviderInterface public function __construct(LdapInterface $ldap, $baseDn, $searchDn = null, $searchPassword = null, array $defaultRoles = array(), $uidKey = 'sAMAccountName', $filter = '({uid_key}={username})', $passwordAttribute = null) { if (null === $uidKey) { - $uidKey = 'uid'; + $uidKey = 'sAMAccountName'; } $this->ldap = $ldap; @@ -87,7 +87,13 @@ public function loadUserByUsername($username) } $entry = $entries[0]; - $username = $this->getAttributeValue($entry, $this->uidKey); + + try { + if (null !== $this->uidKey) { + $username = $this->getAttributeValue($entry, $this->uidKey); + } + } catch (InvalidArgumentException $e) { + } return $this->loadUser($username, $entry); } @@ -123,6 +129,7 @@ public function supportsClass($class) protected function loadUser($username, Entry $entry) { $password = null; + if (null !== $this->passwordAttribute) { $password = $this->getAttributeValue($entry, $this->passwordAttribute); } diff --git a/src/Symfony/Component/Security/Resources/translations/security.lv.xlf b/src/Symfony/Component/Security/Resources/translations/security.lv.xlf deleted file mode 100644 index 33c48c617461c..0000000000000 --- a/src/Symfony/Component/Security/Resources/translations/security.lv.xlf +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - An authentication exception occurred. - Radās autentifikācijas kļūda. - - - Authentication credentials could not be found. - Autentifikācijas dati nav atrasti. - - - Authentication request could not be processed due to a system problem. - Autentifikācijas pieprasījums nevar tikt apstrādāts sistēmas problēmas dēļ. - - - Invalid credentials. - Nederīgi autentifikācijas dati. - - - Cookie has already been used by someone else. - Kāds cits jau izmantoja sīkdatni. - - - Not privileged to request the resource. - Nav tiesību ši resursa izsaukšanai. - - - Invalid CSRF token. - Nederīgs CSRF talons. - - - Digest nonce has expired. - Vienreiz lietojamās atslēgas darbības laiks ir beidzies. - - - No authentication provider found to support the authentication token. - Nav atrasts, autentifikācijas talonu atbalstošs, autentifikācijas sniedzējs. - - - No session available, it either timed out or cookies are not enabled. - Sesija nav pieejama - vai nu tā beidzās, vai nu sīkdatnes nav iespējotas. - - - No token could be found. - Nevar atrast nevienu talonu. - - - Username could not be found. - Nevar atrast lietotājvārdu. - - - Account has expired. - Konta derīguma termiņš ir beidzies. - - - Credentials have expired. - Autentifikācijas datu derīguma termiņš ir beidzies. - - - Account is disabled. - Konts ir atspējots. - - - Account is locked. - Konts ir slēgts. - - - - \ No newline at end of file diff --git a/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php b/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php index d3daf12e46dd5..861c37b349413 100644 --- a/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php +++ b/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php @@ -44,14 +44,15 @@ public function __construct(array $attributes = null, $lowerCamelCase = true) public function normalize($propertyName) { if (null === $this->attributes || in_array($propertyName, $this->attributes)) { + $lcPropertyName = lcfirst($propertyName); $snakeCasedName = ''; - $len = strlen($propertyName); + $len = strlen($lcPropertyName); for ($i = 0; $i < $len; ++$i) { - if (ctype_upper($propertyName[$i])) { - $snakeCasedName .= '_'.strtolower($propertyName[$i]); + if (ctype_upper($lcPropertyName[$i])) { + $snakeCasedName .= '_'.strtolower($lcPropertyName[$i]); } else { - $snakeCasedName .= strtolower($propertyName[$i]); + $snakeCasedName .= strtolower($lcPropertyName[$i]); } } diff --git a/src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php b/src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php index 2d57017340207..2d7131f2371d7 100644 --- a/src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php +++ b/src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php @@ -27,27 +27,30 @@ public function testInterface() /** * @dataProvider attributeProvider */ - public function testNormalize($underscored, $lowerCamelCased) + public function testNormalize($underscored, $camelCased, $useLowerCamelCase) { - $nameConverter = new CamelCaseToSnakeCaseNameConverter(); - $this->assertEquals($nameConverter->normalize($lowerCamelCased), $underscored); + $nameConverter = new CamelCaseToSnakeCaseNameConverter(null, $useLowerCamelCase); + $this->assertEquals($nameConverter->normalize($camelCased), $underscored); } /** * @dataProvider attributeProvider */ - public function testDenormalize($underscored, $lowerCamelCased) + public function testDenormalize($underscored, $camelCased, $useLowerCamelCase) { - $nameConverter = new CamelCaseToSnakeCaseNameConverter(); - $this->assertEquals($nameConverter->denormalize($underscored), $lowerCamelCased); + $nameConverter = new CamelCaseToSnakeCaseNameConverter(null, $useLowerCamelCase); + $this->assertEquals($nameConverter->denormalize($underscored), $camelCased); } public function attributeProvider() { return array( - array('coop_tilleuls', 'coopTilleuls'), - array('_kevin_dunglas', '_kevinDunglas'), - array('this_is_a_test', 'thisIsATest'), + array('coop_tilleuls', 'coopTilleuls', true), + array('_kevin_dunglas', '_kevinDunglas', true), + array('this_is_a_test', 'thisIsATest', true), + array('coop_tilleuls', 'CoopTilleuls', false), + array('_kevin_dunglas', '_kevinDunglas', false), + array('this_is_a_test', 'ThisIsATest', false), ); } } diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index 025fcd89cc12c..928cc9dfd592c 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -137,7 +137,7 @@ protected function loadResource($resource) } /** - * Reads an unsigned long from stream respecting endianess. + * Reads an unsigned long from stream respecting endianness. * * @param resource $stream * @param bool $isBigEndian diff --git a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php index 5ef81712f413c..3396b99dde57a 100644 --- a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php @@ -86,8 +86,6 @@ private function createCollector() $translator->addResource('array', array('bar' => 'bar (fr)'), 'fr'); $translator->addResource('array', array('bar_ru' => 'bar (ru)'), 'ru'); - $collector = new DataCollectorTranslator($translator); - - return $collector; + return new DataCollectorTranslator($translator); } } diff --git a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php index 2f19a3fed8bcb..e4d08d4f8f1a8 100644 --- a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php @@ -304,10 +304,6 @@ public function mergeConstraints(ClassMetadata $source) } foreach ($source->getConstrainedProperties() as $property) { - if ($this->hasPropertyMetadata($property)) { - continue; - } - foreach ($source->getPropertyMetadata($property) as $member) { $member = clone $member; diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticCar.php b/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticCar.php new file mode 100644 index 0000000000000..38c82982b1436 --- /dev/null +++ b/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticCar.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Constraints\Length; + +class EntityStaticCar extends EntityStaticVehicle +{ + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addPropertyConstraint('wheels', new Length(array('max' => 99))); + } +} diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticCarTurbo.php b/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticCarTurbo.php new file mode 100644 index 0000000000000..83f192e7bd00d --- /dev/null +++ b/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticCarTurbo.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Constraints\Length; + +class EntityStaticCarTurbo extends EntityStaticCar +{ + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addPropertyConstraint('wheels', new Length(array('max' => 99))); + } +} diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticVehicle.php b/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticVehicle.php new file mode 100644 index 0000000000000..41e616b03f433 --- /dev/null +++ b/src/Symfony/Component/Validator/Tests/Fixtures/EntityStaticVehicle.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Fixtures; + +use Symfony\Component\Validator\Mapping\ClassMetadata; +use Symfony\Component\Validator\Constraints\Length; + +class EntityStaticVehicle +{ + public $wheels; + + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addPropertyConstraint('wheels', new Length(array('max' => 99))); + } +} diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php index 99b15aa9a4cc8..51b5a09802fe8 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Validator\Tests\Mapping; use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; @@ -304,21 +303,6 @@ public function testGetPropertyMetadataReturnsEmptyArrayWithoutConfiguredMetadat { $this->assertCount(0, $this->metadata->getPropertyMetadata('foo'), '->getPropertyMetadata() returns an empty collection if no metadata is configured for the given property'); } - - public function testMergeDoesOverrideConstraintsFromParentClassIfPropertyIsOverriddenInChildClass() - { - $parentMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ParentClass'); - $parentMetadata->addPropertyConstraint('example', new GreaterThan(0)); - - $childMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ChildClass'); - $childMetadata->addPropertyConstraint('example', new GreaterThan(1)); - $childMetadata->mergeConstraints($parentMetadata); - - $expectedMetadata = new ClassMetadata('\Symfony\Component\Validator\Tests\Mapping\ChildClass'); - $expectedMetadata->addPropertyConstraint('example', new GreaterThan(1)); - - $this->assertEquals($expectedMetadata, $childMetadata); - } } class ParentClass diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php index 9696744166537..400c39ce4cfa9 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php @@ -168,6 +168,25 @@ public function testMetadataCacheWithRuntimeConstraint() $metadata = $factory->getMetadataFor(self::CLASS_NAME); } + + public function testGroupsFromParent() + { + $reader = new \Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader(); + $factory = new LazyLoadingMetadataFactory($reader); + $metadata = $factory->getMetadataFor('Symfony\Component\Validator\Tests\Fixtures\EntityStaticCarTurbo'); + $groups = array(); + + foreach ($metadata->getPropertyMetadata('wheels') as $propertyMetadata) { + $constraints = $propertyMetadata->getConstraints(); + $groups = array_replace($groups, $constraints[0]->groups); + } + + $this->assertCount(4, $groups); + $this->assertContains('Default', $groups); + $this->assertContains('EntityStaticCarTurbo', $groups); + $this->assertContains('EntityStaticCar', $groups); + $this->assertContains('EntityStaticVehicle', $groups); + } } class TestLoader implements LoaderInterface diff --git a/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php b/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php index 6a6fc9297082b..655262f4065ec 100644 --- a/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/AmqpCaster.php @@ -48,6 +48,15 @@ public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, { $prefix = Caster::PREFIX_VIRTUAL; + $a += array( + $prefix.'is_connected' => $c->isConnected(), + ); + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPConnection\x00login"])) { + return $a; + } + // BC layer in the amqp lib if (method_exists($c, 'getReadTimeout')) { $timeout = $c->getReadTimeout(); @@ -56,13 +65,13 @@ public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, } $a += array( - $prefix.'isConnected' => $c->isConnected(), + $prefix.'is_connected' => $c->isConnected(), $prefix.'login' => $c->getLogin(), $prefix.'password' => $c->getPassword(), $prefix.'host' => $c->getHost(), - $prefix.'port' => $c->getPort(), $prefix.'vhost' => $c->getVhost(), - $prefix.'readTimeout' => $timeout, + $prefix.'port' => $c->getPort(), + $prefix.'read_timeout' => $timeout, ); return $a; @@ -73,11 +82,19 @@ public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, $isNes $prefix = Caster::PREFIX_VIRTUAL; $a += array( - $prefix.'isConnected' => $c->isConnected(), - $prefix.'channelId' => $c->getChannelId(), - $prefix.'prefetchSize' => $c->getPrefetchSize(), - $prefix.'prefetchCount' => $c->getPrefetchCount(), + $prefix.'is_connected' => $c->isConnected(), + $prefix.'channel_id' => $c->getChannelId(), + ); + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPChannel\x00connection"])) { + return $a; + } + + $a += array( $prefix.'connection' => $c->getConnection(), + $prefix.'prefetch_size' => $c->getPrefetchSize(), + $prefix.'prefetch_count' => $c->getPrefetchCount(), ); return $a; @@ -88,11 +105,19 @@ public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, $isNested) $prefix = Caster::PREFIX_VIRTUAL; $a += array( - $prefix.'name' => $c->getName(), $prefix.'flags' => self::extractFlags($c->getFlags()), - $prefix.'arguments' => $c->getArguments(), + ); + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPQueue\x00name"])) { + return $a; + } + + $a += array( $prefix.'connection' => $c->getConnection(), $prefix.'channel' => $c->getChannel(), + $prefix.'name' => $c->getName(), + $prefix.'arguments' => $c->getArguments(), ); return $a; @@ -103,12 +128,24 @@ public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, $isN $prefix = Caster::PREFIX_VIRTUAL; $a += array( - $prefix.'name' => $c->getName(), $prefix.'flags' => self::extractFlags($c->getFlags()), - $prefix.'type' => isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType(), - $prefix.'arguments' => $c->getArguments(), - $prefix.'channel' => $c->getChannel(), + ); + + $type = isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType(); + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPExchange\x00name"])) { + $a["\x00AMQPExchange\x00type"] = $type; + + return $a; + } + + $a += array( $prefix.'connection' => $c->getConnection(), + $prefix.'channel' => $c->getChannel(), + $prefix.'name' => $c->getName(), + $prefix.'type' => $type, + $prefix.'arguments' => $c->getArguments(), ); return $a; @@ -118,28 +155,37 @@ public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, $isN { $prefix = Caster::PREFIX_VIRTUAL; + $deliveryMode = new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode()); + + // Recent version of the extension already expose private properties + if (isset($a["\x00AMQPEnvelope\x00body"])) { + $a["\0AMQPEnvelope\0delivery_mode"] = $deliveryMode; + + return $a; + } + if (!($filter & Caster::EXCLUDE_VERBOSE)) { $a += array($prefix.'body' => $c->getBody()); } $a += array( - $prefix.'routingKey' => $c->getRoutingKey(), - $prefix.'deliveryTag' => $c->getDeliveryTag(), - $prefix.'deliveryMode' => new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode()), - $prefix.'exchangeName' => $c->getExchangeName(), - $prefix.'isRedelivery' => $c->isRedelivery(), - $prefix.'contentType' => $c->getContentType(), - $prefix.'contentEncoding' => $c->getContentEncoding(), - $prefix.'type' => $c->getType(), - $prefix.'timestamp' => $c->getTimeStamp(), + $prefix.'delivery_tag' => $c->getDeliveryTag(), + $prefix.'is_redelivery' => $c->isRedelivery(), + $prefix.'exchange_name' => $c->getExchangeName(), + $prefix.'routing_key' => $c->getRoutingKey(), + $prefix.'content_type' => $c->getContentType(), + $prefix.'content_encoding' => $c->getContentEncoding(), + $prefix.'headers' => $c->getHeaders(), + $prefix.'delivery_mode' => $deliveryMode, $prefix.'priority' => $c->getPriority(), + $prefix.'correlation_id' => $c->getCorrelationId(), + $prefix.'reply_to' => $c->getReplyTo(), $prefix.'expiration' => $c->getExpiration(), - $prefix.'userId' => $c->getUserId(), - $prefix.'appId' => $c->getAppId(), - $prefix.'messageId' => $c->getMessageId(), - $prefix.'replyTo' => $c->getReplyTo(), - $prefix.'correlationId' => $c->getCorrelationId(), - $prefix.'headers' => $c->getHeaders(), + $prefix.'message_id' => $c->getMessageId(), + $prefix.'timestamp' => $c->getTimeStamp(), + $prefix.'type' => $c->getType(), + $prefix.'user_id' => $c->getUserId(), + $prefix.'app_id' => $c->getAppId(), ); return $a; diff --git a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php index 35053134f9143..dcb5a2f29ca34 100644 --- a/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php @@ -65,7 +65,20 @@ public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested) public static function castGenerator(\Generator $c, array $a, Stub $stub, $isNested) { - return class_exists('ReflectionGenerator', false) ? self::castReflectionGenerator(new \ReflectionGenerator($c), $a, $stub, $isNested) : $a; + if (!class_exists('ReflectionGenerator', false)) { + return $a; + } + + // Cannot create ReflectionGenerator based on a terminated Generator + try { + $reflectionGenerator = new \ReflectionGenerator($c); + } catch (\Exception $e) { + $a[Caster::PREFIX_VIRTUAL.'closed'] = true; + + return $a; + } + + return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested); } public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNested) @@ -88,31 +101,33 @@ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a if ($c->getThis()) { $a[$prefix.'this'] = new CutStub($c->getThis()); } - $x = $c->getFunction(); + $function = $c->getFunction(); $frame = array( - 'class' => isset($x->class) ? $x->class : null, - 'type' => isset($x->class) ? ($x->isStatic() ? '::' : '->') : null, - 'function' => $x->name, + 'class' => isset($function->class) ? $function->class : null, + 'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null, + 'function' => $function->name, 'file' => $c->getExecutingFile(), 'line' => $c->getExecutingLine(), ); if ($trace = $c->getTrace(DEBUG_BACKTRACE_IGNORE_ARGS)) { - $x = new \ReflectionGenerator($c->getExecutingGenerator()); + $function = new \ReflectionGenerator($c->getExecutingGenerator()); array_unshift($trace, array( 'function' => 'yield', - 'file' => $x->getExecutingFile(), - 'line' => $x->getExecutingLine() - 1, + 'file' => $function->getExecutingFile(), + 'line' => $function->getExecutingLine() - 1, )); $trace[] = $frame; $a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1); } else { - $x = new FrameStub($frame, false, true); - $x = ExceptionCaster::castFrameStub($x, array(), $x, true); + $function = new FrameStub($frame, false, true); + $function = ExceptionCaster::castFrameStub($function, array(), $function, true); $a[$prefix.'executing'] = new EnumStub(array( - $frame['class'].$frame['type'].$frame['function'].'()' => $x[$prefix.'src'], + $frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'], )); } + $a[Caster::PREFIX_VIRTUAL.'closed'] = false; + return $a; } diff --git a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php index 9f8f76af049f1..437230e24eadb 100644 --- a/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php +++ b/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php @@ -118,6 +118,7 @@ abstract class AbstractCloner implements ClonerInterface ':pgsql result' => 'Symfony\Component\VarDumper\Caster\PgSqlCaster::castResult', ':process' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castProcess', ':stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream', + ':persistent stream' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStream', ':stream-context' => 'Symfony\Component\VarDumper\Caster\ResourceCaster::castStreamContext', ':xml' => 'Symfony\Component\VarDumper\Caster\XmlResourceCaster::castXml', ); diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index e2e8ecf132077..540f9245fdfd3 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -127,9 +127,9 @@ public function dumpScalar(Cursor $cursor, $type, $value) $style = 'num'; switch (true) { - case INF === $value: $value = 'INF'; break; + case INF === $value: $value = 'INF'; break; case -INF === $value: $value = '-INF'; break; - case is_nan($value): $value = 'NAN'; break; + case is_nan($value): $value = 'NAN'; break; default: $value = (string) $value; if (false === strpos($value, $this->decimalPoint)) { diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php index fc5cee379f59f..bf84b5c10c5bd 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php @@ -151,11 +151,10 @@ public function testGenerator() $this->markTestSkipped('xdebug is active'); } - $g = new GeneratorDemo(); - $g = $g->baz(); - $r = new \ReflectionGenerator($g); + $generator = new GeneratorDemo(); + $generator = $generator->baz(); - $xDump = <<<'EODUMP' + $expectedDump = <<<'EODUMP' Generator { this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} executing: { @@ -167,16 +166,17 @@ public function testGenerator() } } } + closed: false } EODUMP; - $this->assertDumpMatchesFormat($xDump, $g); + $this->assertDumpMatchesFormat($expectedDump, $generator); - foreach ($g as $v) { + foreach ($generator as $v) { break; } - $xDump = <<<'EODUMP' + $expectedDump = <<<'EODUMP' array:2 [ 0 => ReflectionGenerator { this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …} @@ -197,6 +197,7 @@ public function testGenerator() : } } } + closed: false } 1 => Generator { executing: { @@ -208,11 +209,23 @@ public function testGenerator() } } } + closed: false } ] EODUMP; - $this->assertDumpMatchesFormat($xDump, array($r, $r->getExecutingGenerator())); + $r = new \ReflectionGenerator($generator); + $this->assertDumpMatchesFormat($expectedDump, array($r, $r->getExecutingGenerator())); + + foreach ($generator as $v) { + } + + $expectedDump = <<<'EODUMP' +Generator { + closed: true +} +EODUMP; + $this->assertDumpMatchesFormat($expectedDump, $generator); } } diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php index 01927b209c2ff..38abe73552d37 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php @@ -12,7 +12,7 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase private $dumper; - public function setUp() + protected function setUp() { $this->dumper = new GraphvizDumper(); } diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php index c9a49b36f71e1..75c0856123369 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php @@ -12,7 +12,7 @@ class StateMachineGraphvizDumperTest extends \PHPUnit_Framework_TestCase private $dumper; - public function setUp() + protected function setUp() { $this->dumper = new StateMachineGraphvizDumper(); } diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index f44625a28e274..224ce0a67b0e0 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -684,7 +684,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) $previousLineIndented = false; $previousLineBlank = false; - for ($i = 0; $i < count($blockLines); ++$i) { + for ($i = 0, $blockLinesCount = count($blockLines); $i < $blockLinesCount; ++$i) { if ('' === $blockLines[$i]) { $text .= "\n"; $previousLineIndented = false;