From 2c83825136407f8e76fb129d88e04b763e2df7f7 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 14:28:17 +0100 Subject: [PATCH 01/36] updated CHANGELOG for 2.3.22 --- CHANGELOG-2.3.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md index 7b7a4b3add..e94f44eb39 100644 --- a/CHANGELOG-2.3.md +++ b/CHANGELOG-2.3.md @@ -7,6 +7,21 @@ in 2.3 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1 +* 2.3.22 (2014-11-20) + + * bug #12525 [Bundle][FrameworkBundle] be smarter when guessing the document root (xabbuh) + * bug #12296 [SecurityBundle] Authentication entry point is only registered with firewall exception listener, not with authentication listeners (rjkip) + * bug #12393 [DependencyInjection] inlined factory not referenced (boekkooi) + * bug #12436 [Filesystem] Fixed case for empty folder (yosmanyga) + * bug #12370 [Yaml] improve error message for multiple documents (xabbuh) + * bug #12170 [Form] fix form handling with OPTIONS request method (Tobion) + * bug #12235 [Validator] Fixed Regex::getHtmlPattern() to work with complex and negated patterns (webmozart) + * bug #12326 [Session] remove invalid hack in session regenerate (Tobion) + * bug #12341 [Kernel] ensure session is saved before sending response (Tobion) + * bug #12329 [Routing] serialize the compiled route to speed things up (Tobion) + * bug #12316 Break infinite loop while resolving aliases (chx) + * bug #12313 [Security][listener] change priority of switchuser (aitboudad) + * 2.3.21 (2014-10-24) * bug #11696 [Form] Fix #11694 - Enforce options value type check in some form types (kix) From 66f194ef85a14fb25762f1e8f36752a03a18f99d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 14:28:44 +0100 Subject: [PATCH 02/36] update CONTRIBUTORS for 2.3.22 --- CONTRIBUTORS.md | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ce486c92ec..cde155aa47 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -24,9 +24,9 @@ Symfony2 is the result of the work of many people who made the code better - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Hugo Hamon (hhamon) + - Nicolas Grekas (nicolas-grekas) - Martin Hasoň (hason) - Eriksen Costa (eriksencosta) - - Nicolas Grekas (nicolas-grekas) - Christian Flothmann (xabbuh) - Jonathan Wage (jwage) - Grégoire Pineau (lyrixx) @@ -40,8 +40,8 @@ Symfony2 is the result of the work of many people who made the code better - Saša Stamenković (umpirsky) - Miha Vrhovnik - Henrik Bjørnskov (henrikbjorn) - - Konstantin Kudryashov (everzet) - Wouter De Jong (wouterj) + - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - Eric Clemmons (ericclemmons) @@ -65,8 +65,8 @@ Symfony2 is the result of the work of many people who made the code better - Luis Cordova (cordoval) - Arnaud Le Blanc (arnaud-lb) - Kevin Bond (kbond) - - Tim Nagel (merk) - Ait Boudad Abdellatif (aitboudad) + - Tim Nagel (merk) - Brice BERNARD (brikou) - marc.weistroff - lenar @@ -120,6 +120,7 @@ Symfony2 is the result of the work of many people who made the code better - Andreas Hucks (meandmymonkey) - Andréia Bohner (andreia) - Noel Guilbert (noel) + - Peter Rehm (rpet) - Charles Sarrazin (csarrazi) - bronze1man - sun (sun) @@ -138,7 +139,6 @@ Symfony2 is the result of the work of many people who made the code better - Sven Paulus (subsven) - Lars Strojny (lstrojny) - Joel Wurtz (brouznouf) - - Peter Rehm (rpet) - Rui Marinho (ruimarinho) - Matthias Pigulla (mpdude) - Julien Brochet (mewt) @@ -173,6 +173,7 @@ Symfony2 is the result of the work of many people who made the code better - jdhoek - Nikita Konstantinov - Wodor Wodorski + - Iltar van der Berg - julien pauli (jpauli) - Beau Simensen (simensen) - Robert Kiss (kepten) @@ -185,6 +186,7 @@ Symfony2 is the result of the work of many people who made the code better - Chris Smith (cs278) - Florian Klein (docteurklein) - Manuel Kiessling (manuelkiessling) + - Daniel Wehner - Atsuhiro KUBO (iteman) - Andrew Moore (finewolf) - Bertrand Zuchuat (garfield-fr) @@ -207,7 +209,6 @@ Symfony2 is the result of the work of many people who made the code better - janschoenherr - Marco Pivetta (ocramius) - Ricard Clau (ricardclau) - - Iltar van der Berg - Erin Millard - John Kary (johnkary) - Matthew Lewinski (lewinski) @@ -246,6 +247,7 @@ Symfony2 is the result of the work of many people who made the code better - Shein Alexey - Joe Lencioni - Kai + - Karoly Negyesi (chx) - Xavier HAUSHERR - Albert Jessurum (ajessu) - Laszlo Korte @@ -301,7 +303,6 @@ Symfony2 is the result of the work of many people who made the code better - Iker Ibarguren (ikerib) - Ricardo Oliveira (ricardolotr) - ondrowan - - Daniel Wehner - Evan S Kaufman (evanskaufman) - mcben - Maks Slesarenko @@ -311,6 +312,7 @@ Symfony2 is the result of the work of many people who made the code better - Ioan Negulescu - Jakub Škvára (jskvara) - Andrew Udvare (audvare) + - Sarah Khalil (saro0h) - alexpods - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) @@ -334,8 +336,8 @@ Symfony2 is the result of the work of many people who made the code better - Lenar Lõhmus - Zach Badgett (zachbadgett) - Aurélien Fredouelle - - Karoly Negyesi (chx) - Pavel Campr (pcampr) + - Disquedur - Geoffrey Tran (geoff) - Jan Behrens - Sebastian Krebs @@ -363,6 +365,7 @@ Symfony2 is the result of the work of many people who made the code better - Maxime Douailin - Javier López (loalf) - Dustin Dobervich (dustin10) + - Warnar Boekkooi - Alexander M. Turek (derrabus) - Sebastian Marek (proofek) - Erkhembayar Gantulga (erheme318) @@ -421,6 +424,7 @@ Symfony2 is the result of the work of many people who made the code better - Venu - Lars Vierbergen - Mark Challoner + - Dennis Hotson - Andrew Tchircoff (andrewtch) - michaelwilliams - 1emming @@ -431,6 +435,7 @@ Symfony2 is the result of the work of many people who made the code better - John Bohn (jbohn) - Andrew Hilobok (hilobok) - Christian Soronellas (theunic) + - Yosmany Garcia (yosmanyga) - Daniel Beyer - Jérôme Vieilledent (lolautruche) - Degory Valentine @@ -480,9 +485,9 @@ Symfony2 is the result of the work of many people who made the code better - grizlik - Derek ROTH - Shin Ohno (ganchiku) + - Geert De Deckere (geertdd) - Jan Kramer (jankramer) - abdul malik ikhsan (samsonasik) - - Sarah Khalil (saro0h) - Timothée Barray (tyx) - Benjamin Laugueux (yzalis) - Christian Morgan @@ -531,6 +536,7 @@ Symfony2 is the result of the work of many people who made the code better - Radosław Benkel - ttomor - Mei Gwilym (meigwilym) + - Michael H. Arieli (excelwebzone) - Luciano Mammino (loige) - fabios - Sander Coolen (scoolen) @@ -540,6 +546,7 @@ Symfony2 is the result of the work of many people who made the code better - Anton Babenko (antonbabenko) - Irmantas Šiupšinskas (irmantas) - Danilo Silva + - Stepan Anchugov (kix) - Zachary Tong (polyfractal) - Hryhorii Hrebiniuk - dantleech @@ -567,7 +574,6 @@ Symfony2 is the result of the work of many people who made the code better - Boris Vujicic (boris.vujicic) - Max Beutel - Catalin Dan - - Warnar Boekkooi - Piotr Antosik (antek88) - Artem Lopata - Marcos Quesada (marcos_quesada) @@ -592,6 +598,7 @@ Symfony2 is the result of the work of many people who made the code better - Daniel Mecke (daniel_mecke) - Matteo Giachino (matteosister) - Alex Demchenko (pilot) + - Tadas Gliaubicas (tadcka) - Benoit Garret - Thomas Royer (cydonia7) - DerManoMann @@ -708,6 +715,7 @@ Symfony2 is the result of the work of many people who made the code better - Max Summe - WedgeSama - Felds Liscia + - James Halsall (jaitsu) - Maxime Veber (nek-) - Tadcka - Beth Binkovitz @@ -734,7 +742,6 @@ Symfony2 is the result of the work of many people who made the code better - r1pp3rj4ck - Robert Queck - mlively - - Dennis Hotson - Fabian Steiner (fabstei) - Klaus Silveira (klaussilveira) - Thomas Chmielowiec (chmielot) @@ -780,6 +787,7 @@ Symfony2 is the result of the work of many people who made the code better - Martin Eckhardt - Denis Zunke - Jonathan Poston + - Adrian Olek (adrianolek) - Przemysław Piechota (kibao) - Leonid Terentyev (li0n) - Adam Prager (padam87) @@ -800,7 +808,6 @@ Symfony2 is the result of the work of many people who made the code better - Paul Seiffert (seiffert) - Vasily Khayrulin (sirian) - Stefan Koopmanschap (skoop) - - Yosmany Garcia (yosmanyga) - Ivan Kurnosov - stloyd - Chris Tickner @@ -891,6 +898,7 @@ Symfony2 is the result of the work of many people who made the code better - Joel Marcey - David Christmann - root + - James Hudson - Tom Maguire - David Zuelke - Pierre Rineau @@ -906,6 +914,7 @@ Symfony2 is the result of the work of many people who made the code better - grifx - Robert Campbell - Matt Lehner + - Hein Zaw Htet™ - Ruben Kruiswijk - Michael J - Alex Pods @@ -944,7 +953,9 @@ Symfony2 is the result of the work of many people who made the code better - Vincent Composieux (eko) - Franz Liedke (franzliedke) - gondo (gondo) + - Gusakov Nikita (hell0w0rd) - Osman Üngür (import) + - Jelle Bekker (jbekker) - Ian Jenkins (jenkoian) - Jorge Martin (jorgemartind) - Kevin Herrera (kherge) @@ -973,6 +984,7 @@ Symfony2 is the result of the work of many people who made the code better - Daniele Cesarini (ijanki) - Ismail Asci (ismailasci) - Simon CONSTANS (kosssi) + - Kristof Van Cauwenbergh (kristofvc) - Ramon Henrique Ornelas (ramonornela) - Till Klampaeckel (till) - Tobias Weinert (tweini) @@ -1003,6 +1015,7 @@ Symfony2 is the result of the work of many people who made the code better - patrick-mcdougle - Dariusz Czech - Anonymous User + - Eric J. Duran - cmfcmf - Drew Butler - Steve Müller @@ -1118,6 +1131,7 @@ Symfony2 is the result of the work of many people who made the code better - Vincent (vincent1870) - Eugene Babushkin (warl) - Xavier Amado (xamado) + - Dawid Pakuła (zulusx) - Florent Cailhol - szymek - craigmarvelley From ace20d48857e640572e0310206e3173f2d829be1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 14:28:56 +0100 Subject: [PATCH 03/36] updated VERSION for 2.3.22 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 9e238d4029..83ccbe8f07 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.22-DEV'; + const VERSION = '2.3.22'; const VERSION_ID = '20322'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '3'; const RELEASE_VERSION = '22'; - const EXTRA_VERSION = 'DEV'; + constEXTRA_VERSION = ''; /** * Constructor. From 2f59c8df55b2273565e8898373ebc38457c10c32 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 14:51:29 +0100 Subject: [PATCH 04/36] fixed typo --- src/Symfony/Component/HttpKernel/Kernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 83ccbe8f07..8f983c7a8d 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -64,7 +64,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface const MAJOR_VERSION = '2'; const MINOR_VERSION = '3'; const RELEASE_VERSION = '22'; - constEXTRA_VERSION = ''; + const EXTRA_VERSION = ''; /** * Constructor. From 580de752494109d1cdb084b4e093c096a1cbcabc Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 16:26:37 +0100 Subject: [PATCH 05/36] bumped Symfony version to 2.3.23 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 8f983c7a8d..08a2a6ac56 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.22'; - const VERSION_ID = '20322'; + const VERSION = '2.3.23-DEV'; + const VERSION_ID = '20323'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '3'; - const RELEASE_VERSION = '22'; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = '23'; + const EXTRA_VERSION = 'DEV'; /** * Constructor. From 34b5f71d5850553ccd7e27c7d391be8bcb3f3a48 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 16:59:52 +0100 Subject: [PATCH 06/36] updated CHANGELOG for 2.5.7 --- CHANGELOG-2.5.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG-2.5.md b/CHANGELOG-2.5.md index 41670dad3a..1e76efce7c 100644 --- a/CHANGELOG-2.5.md +++ b/CHANGELOG-2.5.md @@ -7,6 +7,26 @@ in 2.5 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.5.0...v2.5.1 +* 2.5.7 (2014-11-20) + + * bug #12525 [Bundle][FrameworkBundle] be smarter when guessing the document root (xabbuh) + * bug #12296 [SecurityBundle] Authentication entry point is only registered with firewall exception listener, not with authentication listeners (rjkip) + * bug #12489 [FrameworkBundle] Fix server run in case the router script does not exist (romainneutron) + * bug #12443 [HttpKernel] Adding support for invokable controllers in the RequestDataCollector (jameshalsall) + * bug #12393 [DependencyInjection] inlined factory not referenced (boekkooi) + * bug #12436 [Filesystem] Fixed case for empty folder (yosmanyga) + * bug #12397 [Routing] fix BC (nicolas-grekas) + * bug #12382 [Routing] removed errors from git (HeinZawHtet) + * bug #12370 [Yaml] improve error message for multiple documents (xabbuh) + * bug #12170 [Form] fix form handling with OPTIONS request method (Tobion) + * bug #12235 [Validator] Fixed Regex::getHtmlPattern() to work with complex and negated patterns (webmozart) + * bug #12326 [Session] remove invalid hack in session regenerate (Tobion) + * bug #12341 [Kernel] ensure session is saved before sending response (Tobion) + * bug #12329 [Routing] serialize the compiled route to speed things up (Tobion) + * bug #12291 [Form] Fixed usage of "name" variable in form_start block (webmozart) + * bug #12316 Break infinite loop while resolving aliases (chx) + * bug #12313 [Security][listener] change priority of switchuser (aitboudad) + * 2.5.6 (2014-10-24) * bug #11696 [Form] Fix #11694 - Enforce options value type check in some form types (kix) From 3e1f6a305779e51485533338783597c138fc3979 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 17:00:01 +0100 Subject: [PATCH 07/36] update CONTRIBUTORS for 2.5.7 --- CONTRIBUTORS.md | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ce486c92ec..cde155aa47 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -24,9 +24,9 @@ Symfony2 is the result of the work of many people who made the code better - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Hugo Hamon (hhamon) + - Nicolas Grekas (nicolas-grekas) - Martin Hasoň (hason) - Eriksen Costa (eriksencosta) - - Nicolas Grekas (nicolas-grekas) - Christian Flothmann (xabbuh) - Jonathan Wage (jwage) - Grégoire Pineau (lyrixx) @@ -40,8 +40,8 @@ Symfony2 is the result of the work of many people who made the code better - Saša Stamenković (umpirsky) - Miha Vrhovnik - Henrik Bjørnskov (henrikbjorn) - - Konstantin Kudryashov (everzet) - Wouter De Jong (wouterj) + - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - Eric Clemmons (ericclemmons) @@ -65,8 +65,8 @@ Symfony2 is the result of the work of many people who made the code better - Luis Cordova (cordoval) - Arnaud Le Blanc (arnaud-lb) - Kevin Bond (kbond) - - Tim Nagel (merk) - Ait Boudad Abdellatif (aitboudad) + - Tim Nagel (merk) - Brice BERNARD (brikou) - marc.weistroff - lenar @@ -120,6 +120,7 @@ Symfony2 is the result of the work of many people who made the code better - Andreas Hucks (meandmymonkey) - Andréia Bohner (andreia) - Noel Guilbert (noel) + - Peter Rehm (rpet) - Charles Sarrazin (csarrazi) - bronze1man - sun (sun) @@ -138,7 +139,6 @@ Symfony2 is the result of the work of many people who made the code better - Sven Paulus (subsven) - Lars Strojny (lstrojny) - Joel Wurtz (brouznouf) - - Peter Rehm (rpet) - Rui Marinho (ruimarinho) - Matthias Pigulla (mpdude) - Julien Brochet (mewt) @@ -173,6 +173,7 @@ Symfony2 is the result of the work of many people who made the code better - jdhoek - Nikita Konstantinov - Wodor Wodorski + - Iltar van der Berg - julien pauli (jpauli) - Beau Simensen (simensen) - Robert Kiss (kepten) @@ -185,6 +186,7 @@ Symfony2 is the result of the work of many people who made the code better - Chris Smith (cs278) - Florian Klein (docteurklein) - Manuel Kiessling (manuelkiessling) + - Daniel Wehner - Atsuhiro KUBO (iteman) - Andrew Moore (finewolf) - Bertrand Zuchuat (garfield-fr) @@ -207,7 +209,6 @@ Symfony2 is the result of the work of many people who made the code better - janschoenherr - Marco Pivetta (ocramius) - Ricard Clau (ricardclau) - - Iltar van der Berg - Erin Millard - John Kary (johnkary) - Matthew Lewinski (lewinski) @@ -246,6 +247,7 @@ Symfony2 is the result of the work of many people who made the code better - Shein Alexey - Joe Lencioni - Kai + - Karoly Negyesi (chx) - Xavier HAUSHERR - Albert Jessurum (ajessu) - Laszlo Korte @@ -301,7 +303,6 @@ Symfony2 is the result of the work of many people who made the code better - Iker Ibarguren (ikerib) - Ricardo Oliveira (ricardolotr) - ondrowan - - Daniel Wehner - Evan S Kaufman (evanskaufman) - mcben - Maks Slesarenko @@ -311,6 +312,7 @@ Symfony2 is the result of the work of many people who made the code better - Ioan Negulescu - Jakub Škvára (jskvara) - Andrew Udvare (audvare) + - Sarah Khalil (saro0h) - alexpods - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) @@ -334,8 +336,8 @@ Symfony2 is the result of the work of many people who made the code better - Lenar Lõhmus - Zach Badgett (zachbadgett) - Aurélien Fredouelle - - Karoly Negyesi (chx) - Pavel Campr (pcampr) + - Disquedur - Geoffrey Tran (geoff) - Jan Behrens - Sebastian Krebs @@ -363,6 +365,7 @@ Symfony2 is the result of the work of many people who made the code better - Maxime Douailin - Javier López (loalf) - Dustin Dobervich (dustin10) + - Warnar Boekkooi - Alexander M. Turek (derrabus) - Sebastian Marek (proofek) - Erkhembayar Gantulga (erheme318) @@ -421,6 +424,7 @@ Symfony2 is the result of the work of many people who made the code better - Venu - Lars Vierbergen - Mark Challoner + - Dennis Hotson - Andrew Tchircoff (andrewtch) - michaelwilliams - 1emming @@ -431,6 +435,7 @@ Symfony2 is the result of the work of many people who made the code better - John Bohn (jbohn) - Andrew Hilobok (hilobok) - Christian Soronellas (theunic) + - Yosmany Garcia (yosmanyga) - Daniel Beyer - Jérôme Vieilledent (lolautruche) - Degory Valentine @@ -480,9 +485,9 @@ Symfony2 is the result of the work of many people who made the code better - grizlik - Derek ROTH - Shin Ohno (ganchiku) + - Geert De Deckere (geertdd) - Jan Kramer (jankramer) - abdul malik ikhsan (samsonasik) - - Sarah Khalil (saro0h) - Timothée Barray (tyx) - Benjamin Laugueux (yzalis) - Christian Morgan @@ -531,6 +536,7 @@ Symfony2 is the result of the work of many people who made the code better - Radosław Benkel - ttomor - Mei Gwilym (meigwilym) + - Michael H. Arieli (excelwebzone) - Luciano Mammino (loige) - fabios - Sander Coolen (scoolen) @@ -540,6 +546,7 @@ Symfony2 is the result of the work of many people who made the code better - Anton Babenko (antonbabenko) - Irmantas Šiupšinskas (irmantas) - Danilo Silva + - Stepan Anchugov (kix) - Zachary Tong (polyfractal) - Hryhorii Hrebiniuk - dantleech @@ -567,7 +574,6 @@ Symfony2 is the result of the work of many people who made the code better - Boris Vujicic (boris.vujicic) - Max Beutel - Catalin Dan - - Warnar Boekkooi - Piotr Antosik (antek88) - Artem Lopata - Marcos Quesada (marcos_quesada) @@ -592,6 +598,7 @@ Symfony2 is the result of the work of many people who made the code better - Daniel Mecke (daniel_mecke) - Matteo Giachino (matteosister) - Alex Demchenko (pilot) + - Tadas Gliaubicas (tadcka) - Benoit Garret - Thomas Royer (cydonia7) - DerManoMann @@ -708,6 +715,7 @@ Symfony2 is the result of the work of many people who made the code better - Max Summe - WedgeSama - Felds Liscia + - James Halsall (jaitsu) - Maxime Veber (nek-) - Tadcka - Beth Binkovitz @@ -734,7 +742,6 @@ Symfony2 is the result of the work of many people who made the code better - r1pp3rj4ck - Robert Queck - mlively - - Dennis Hotson - Fabian Steiner (fabstei) - Klaus Silveira (klaussilveira) - Thomas Chmielowiec (chmielot) @@ -780,6 +787,7 @@ Symfony2 is the result of the work of many people who made the code better - Martin Eckhardt - Denis Zunke - Jonathan Poston + - Adrian Olek (adrianolek) - Przemysław Piechota (kibao) - Leonid Terentyev (li0n) - Adam Prager (padam87) @@ -800,7 +808,6 @@ Symfony2 is the result of the work of many people who made the code better - Paul Seiffert (seiffert) - Vasily Khayrulin (sirian) - Stefan Koopmanschap (skoop) - - Yosmany Garcia (yosmanyga) - Ivan Kurnosov - stloyd - Chris Tickner @@ -891,6 +898,7 @@ Symfony2 is the result of the work of many people who made the code better - Joel Marcey - David Christmann - root + - James Hudson - Tom Maguire - David Zuelke - Pierre Rineau @@ -906,6 +914,7 @@ Symfony2 is the result of the work of many people who made the code better - grifx - Robert Campbell - Matt Lehner + - Hein Zaw Htet™ - Ruben Kruiswijk - Michael J - Alex Pods @@ -944,7 +953,9 @@ Symfony2 is the result of the work of many people who made the code better - Vincent Composieux (eko) - Franz Liedke (franzliedke) - gondo (gondo) + - Gusakov Nikita (hell0w0rd) - Osman Üngür (import) + - Jelle Bekker (jbekker) - Ian Jenkins (jenkoian) - Jorge Martin (jorgemartind) - Kevin Herrera (kherge) @@ -973,6 +984,7 @@ Symfony2 is the result of the work of many people who made the code better - Daniele Cesarini (ijanki) - Ismail Asci (ismailasci) - Simon CONSTANS (kosssi) + - Kristof Van Cauwenbergh (kristofvc) - Ramon Henrique Ornelas (ramonornela) - Till Klampaeckel (till) - Tobias Weinert (tweini) @@ -1003,6 +1015,7 @@ Symfony2 is the result of the work of many people who made the code better - patrick-mcdougle - Dariusz Czech - Anonymous User + - Eric J. Duran - cmfcmf - Drew Butler - Steve Müller @@ -1118,6 +1131,7 @@ Symfony2 is the result of the work of many people who made the code better - Vincent (vincent1870) - Eugene Babushkin (warl) - Xavier Amado (xamado) + - Dawid Pakuła (zulusx) - Florent Cailhol - szymek - craigmarvelley From dd4254fc39a702af22cd886a6790769541469da1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 17:00:03 +0100 Subject: [PATCH 08/36] updated VERSION for 2.5.7 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 45e53fb254..79f9477f3f 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.5.7-DEV'; + const VERSION = '2.5.7'; const VERSION_ID = '20507'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '5'; const RELEASE_VERSION = '7'; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; /** * Constructor. From 9500411c9aa8d8c8b03a76a5d3bbf28719dfc542 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 20 Nov 2014 17:26:06 +0100 Subject: [PATCH 09/36] bumped Symfony version to 2.5.8 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 79f9477f3f..098e9e77f9 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.5.7'; - const VERSION_ID = '20507'; + const VERSION = '2.5.8-DEV'; + const VERSION_ID = '20508'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '5'; - const RELEASE_VERSION = '7'; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = '8'; + const EXTRA_VERSION = 'DEV'; /** * Constructor. From 76273bf4592ce4cc2bb48a46022801cffe7998cc Mon Sep 17 00:00:00 2001 From: Strate Date: Sun, 5 Oct 2014 18:00:32 +0400 Subject: [PATCH 10/36] [FrameworkBundle] cache:clear command fills *.php.meta files with wrong data --- .../Command/CacheClearCommand.php | 25 +++++- .../CacheClearCommandTest.php | 78 +++++++++++++++++++ .../Fixture/TestAppKernel.php | 27 +++++++ .../CacheClearCommand/Fixture/config.yml | 2 + 4 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/config.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 0d2f8968d8..1fea1b91a4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -112,6 +112,9 @@ EOF $tempKernel = $this->getTempKernel($realKernel, $namespace, $realKernelClass, $warmupDir); $tempKernel->boot(); + $tempKernelReflection = new \ReflectionObject($tempKernel); + $tempKernelFile = $tempKernelReflection->getFileName(); + // warmup temporary dir $warmer = $tempKernel->getContainer()->get('cache_warmer'); if ($enableOptionalWarmers) { @@ -147,6 +150,9 @@ EOF file_put_contents(str_replace($search, $replace, $file), $content); unlink($file); } + + // remove temp kernel file after cache warmed up + @unlink($tempKernelFile); } /** @@ -186,13 +192,30 @@ namespace $namespace { return '$rootDir'; } + + protected function buildContainer() + { + \$container = parent::buildContainer(); + + // filter container's resources, removing reference to temp kernel file + \$resources = \$container->getResources(); + \$filteredResources = array(); + foreach (\$resources as \$resource) { + if ((string) \$resource !== __FILE__) { + \$filteredResources[] = \$resource; + } + } + + \$container->setResources(\$filteredResources); + + return \$container; + } } } EOF; $this->getContainer()->get('filesystem')->mkdir($warmupDir); file_put_contents($file = $warmupDir.'/kernel.tmp', $code); require_once $file; - @unlink($file); $class = "$namespace\\$class"; return new $class($parent->getEnvironment(), $parent->isDebug()); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php new file mode 100644 index 0000000000..78ab561df1 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php @@ -0,0 +1,78 @@ +fs = new Filesystem(); + $this->kernel = new TestAppKernel('test', true); + $this->rootDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('sf2_cache_'); + $this->kernel->setRootDir($this->rootDir); + $this->fs->mkdir($this->rootDir); + } + + protected function tearDown() + { + $this->fs->remove($this->rootDir); + } + + public function testCacheIsFreshAfterCacheClearedWithWarmup() + { + $input = new ArrayInput(array('cache:clear')); + $application = new Application($this->kernel); + $application->setCatchExceptions(false); + + $application->doRun($input, new NullOutput()); + + // Ensure that all *.meta files are fresh + $finder = new Finder(); + $metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta'); + // simply check that cache is warmed up + $this->assertGreaterThanOrEqual(1, count($metaFiles)); + foreach ($metaFiles as $file) { + $configCache = new ConfigCache(substr($file, 0, -5), true); + $this->assertTrue( + $configCache->isFresh(), + sprintf( + 'Meta file "%s" is not fresh', + (string) $file + ) + ); + } + + // check that app kernel file present in meta file of container's cache + $containerRef = new \ReflectionObject($this->kernel->getContainer()); + $containerFile = $containerRef->getFileName(); + $containerMetaFile = $containerFile.'.meta'; + $kernelRef = new \ReflectionObject($this->kernel); + $kernelFile = $kernelRef->getFileName(); + /** @var ResourceInterface[] $meta */ + $meta = unserialize(file_get_contents($containerMetaFile)); + $found = false; + foreach ($meta as $resource) { + if ((string) $resource === $kernelFile) { + $found = true; + break; + } + } + $this->assertTrue($found, 'Kernel file should present as resource'); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php new file mode 100644 index 0000000000..da835dfd4d --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php @@ -0,0 +1,27 @@ +rootDir = $rootDir; + } + + public function registerContainerConfiguration(LoaderInterface $loader) + { + $loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml'); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/config.yml new file mode 100644 index 0000000000..68f8d04061 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/config.yml @@ -0,0 +1,2 @@ +framework: + secret: test From 2065e00b58c89f1823ce273b8098f3fe679ad2c3 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Mon, 6 Oct 2014 10:52:45 +0200 Subject: [PATCH 11/36] =?UTF-8?q?[TwigBundle]=C2=A0Fix=20error=20page=20pr?= =?UTF-8?q?eview=20for=20custom=20twig.exception=5Fcontroller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExceptionController.php | 77 +++++++------------ .../Controller/PreviewErrorController.php | 56 ++++++++++++++ .../Resources/config/routing/errors.xml | 2 +- .../TwigBundle/Resources/config/twig.xml | 6 ++ .../Controller/ExceptionControllerTest.php | 25 +++--- .../Controller/PreviewErrorControllerTest.php | 56 ++++++++++++++ 6 files changed, 158 insertions(+), 64 deletions(-) create mode 100644 src/Symfony/Bundle/TwigBundle/Controller/PreviewErrorController.php create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 1bd758de5b..395f69785f 100644 --- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -19,7 +19,8 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Templating\TemplateReferenceInterface; /** - * ExceptionController. + * ExceptionController renders error or exception pages for a given + * FlattenException. * * @author Fabien Potencier * @author Matthias Pigulla @@ -27,6 +28,10 @@ use Symfony\Component\Templating\TemplateReferenceInterface; class ExceptionController { protected $twig; + + /** + * @var bool Show error (false) or exception (true) pages by default. + */ protected $debug; public function __construct(\Twig_Environment $twig, $debug) @@ -38,6 +43,10 @@ class ExceptionController /** * Converts an Exception to a Response. * + * A "showException" request parameter can be used to force display of an error page (when set to false) or + * the exception page (when true). If it is not present, the "debug" value passed into the constructor will + * be used. + * * @param Request $request The request * @param FlattenException $exception A FlattenException instance * @param DebugLoggerInterface $logger A DebugLoggerInterface instance @@ -49,25 +58,20 @@ class ExceptionController public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null) { $currentContent = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1)); + $showException = $request->get('showException', $this->debug); // As opposed to an additional parameter, this maintains BC - return $this->createResponse($request, $exception, $this->debug, $logger, $currentContent); - } + $code = $exception->getStatusCode(); - /** - * Displays the error page for arbitrary status codes and formats. - * - * @param Request $request The request - * @param int $code The HTTP status code to show the error page for. - * - * @return Response - * - * @throws \InvalidArgumentException When the error template does not exist - */ - public function testErrorPageAction(Request $request, $code) - { - $exception = FlattenException::create(new \Exception("Something has intentionally gone wrong."), $code); - - return $this->createResponse($request, $exception, false); + return new Response($this->twig->render( + $this->findTemplate($request, $request->getRequestFormat(), $code, $showException), + array( + 'status_code' => $code, + 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', + 'exception' => $exception, + 'logger' => $logger, + 'currentContent' => $currentContent, + ) + )); } /** @@ -90,19 +94,19 @@ class ExceptionController * @param Request $request * @param string $format * @param int $code An HTTP response status code - * @param bool $debug + * @param bool $showException * * @return TemplateReferenceInterface */ - protected function findTemplate(Request $request, $format, $code, $debug) + protected function findTemplate(Request $request, $format, $code, $showException) { - $name = $debug ? 'exception' : 'error'; - if ($debug && 'html' == $format) { + $name = $showException ? 'exception' : 'error'; + if ($showException && 'html' == $format) { $name = 'exception_full'; } - // when not in debug, try to find a template for the specific HTTP status code and format - if (!$debug) { + // For error pages, try to find a template for the specific HTTP status code and format + if (!$showException) { $template = new TemplateReference('TwigBundle', 'Exception', $name.$code, $format, 'twig'); if ($this->templateExists($template)) { return $template; @@ -138,29 +142,4 @@ class ExceptionController return false; } - - /** - * @param Request $request - * @param FlattenException $exception - * @param bool $debug - * @param DebugLoggerInterface $logger - * @param string $currentContent - * - * @return Response - */ - protected function createResponse(Request $request, FlattenException $exception, $debug, DebugLoggerInterface $logger = null, $currentContent = '') - { - $code = $exception->getStatusCode(); - - return new Response($this->twig->render( - (string) $this->findTemplate($request, $request->getRequestFormat(), $code, $debug), - array( - 'status_code' => $code, - 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', - 'exception' => $exception, - 'logger' => $logger, - 'currentContent' => $currentContent, - ) - )); - } } diff --git a/src/Symfony/Bundle/TwigBundle/Controller/PreviewErrorController.php b/src/Symfony/Bundle/TwigBundle/Controller/PreviewErrorController.php new file mode 100644 index 0000000000..b4eb932e58 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Controller/PreviewErrorController.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\Controller; + +use Symfony\Component\HttpKernel\Exception\FlattenException; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpFoundation\Request; + +/** + * PreviewErrorController can be used to test error pages. + * + * It will create a test exception and forward it to another controller. + * + * @author Matthias Pigulla + */ +class PreviewErrorController +{ + protected $kernel; + protected $controller; + + public function __construct(HttpKernelInterface $kernel, $controller) + { + $this->kernel = $kernel; + $this->controller = $controller; + } + + public function previewErrorPageAction(Request $request, $code) + { + $exception = FlattenException::create(new \Exception("Something has intentionally gone wrong."), $code); + + /* + * This Request mimics the parameters set by + * \Symfony\Component\HttpKernel\EventListener\ExceptionListener::duplicateRequest, with + * the additional "showException" flag. + */ + + $subRequest = $request->duplicate(null, null, array( + '_controller' => $this->controller, + 'exception' => $exception, + 'logger' => null, + 'format' => $request->getRequestFormat(), + 'showException' => false, + )); + + return $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST); + } +} diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/routing/errors.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/routing/errors.xml index 493af74c01..bf87f8be7a 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/routing/errors.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/routing/errors.xml @@ -5,7 +5,7 @@ xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - twig.controller.exception:testErrorPageAction + twig.controller.preview_error:previewErrorPageAction html \d+ diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml index c10dc942b1..3c81983dd3 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml @@ -25,6 +25,7 @@ Symfony\Bridge\Twig\Translation\TwigExtractor Symfony\Component\HttpKernel\EventListener\ExceptionListener Symfony\Bundle\TwigBundle\Controller\ExceptionController + Symfony\Bundle\TwigBundle\Controller\PreviewErrorController @@ -133,5 +134,10 @@ %kernel.debug% + + + + %twig.exception_listener.controller% + diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php index 39e17cb221..222ac32c9e 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php @@ -13,6 +13,7 @@ namespace Symfony\Bundle\TwigBundle\Tests\Controller; use Symfony\Bundle\TwigBundle\Tests\TestCase; use Symfony\Bundle\TwigBundle\Controller\ExceptionController; +use Symfony\Component\HttpKernel\Exception\FlattenException; use Symfony\Component\HttpFoundation\Request; class ExceptionControllerTest extends TestCase @@ -42,27 +43,22 @@ class ExceptionControllerTest extends TestCase $controller->showAction($request, $flatten); } - public function testErrorPagesInDebugMode() + public function testShowActionCanBeForcedToShowErrorPage() { $twig = new \Twig_Environment( new \Twig_Loader_Array(array( - 'TwigBundle:Exception:error404.html.twig' => ' - {%- if exception is defined and status_text is defined and status_code is defined -%} - OK - {%- else -%} - "exception" variable is missing - {%- endif -%} - ', + 'TwigBundle:Exception:error404.html.twig' => 'ok', )) ); - $request = Request::create('whatever'); + $request = Request::create('whatever', 'GET', array('showException' => false)); + $exception = FlattenException::create(new \Exception(), 404); + $controller = new ExceptionController($twig, /* "showException" defaults to --> */ true); - $controller = new ExceptionController($twig, /* "debug" set to --> */ true); - $response = $controller->testErrorPageAction($request, 404); + $response = $controller->showAction($request, $exception, null); $this->assertEquals(200, $response->getStatusCode()); // successful request - $this->assertEquals('OK', $response->getContent()); // content of the error404.html template + $this->assertEquals('ok', $response->getContent()); // content of the error404.html template } public function testFallbackToHtmlIfNoTemplateForRequestedFormat() @@ -75,9 +71,10 @@ class ExceptionControllerTest extends TestCase $request = Request::create('whatever'); $request->setRequestFormat('txt'); - + $exception = FlattenException::create(new \Exception()); $controller = new ExceptionController($twig, false); - $response = $controller->testErrorPageAction($request, 42); + + $response = $controller->showAction($request, $exception); $this->assertEquals('html', $request->getRequestFormat()); } diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php new file mode 100644 index 0000000000..2d97b0c7ad --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/Controller/PreviewErrorControllerTest.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\Tests\Controller; + +use Symfony\Bundle\TwigBundle\Controller\PreviewErrorController; +use Symfony\Bundle\TwigBundle\Tests\TestCase; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; + +class PreviewErrorControllerTest extends TestCase +{ + public function testForwardRequestToConfiguredController() + { + $self = $this; + + $request = Request::create('whatever'); + $response = new Response(""); + $code = 123; + $logicalControllerName = 'foo:bar:baz'; + + $kernel = $this->getMock('\Symfony\Component\HttpKernel\HttpKernelInterface'); + $kernel + ->expects($this->once()) + ->method('handle') + ->with( + $this->callback(function (Request $request) use ($self, $logicalControllerName, $code) { + + $self->assertEquals($logicalControllerName, $request->attributes->get('_controller')); + + $exception = $request->attributes->get('exception'); + $self->assertInstanceOf('Symfony\Component\HttpKernel\Exception\FlattenException', $exception); + $self->assertEquals($code, $exception->getStatusCode()); + + $self->assertFalse($request->attributes->get('showException')); + + return true; + }), + $this->equalTo(HttpKernelInterface::SUB_REQUEST) + ) + ->will($this->returnValue($response)); + + $controller = new PreviewErrorController($kernel, $logicalControllerName); + + $this->assertSame($response, $controller->previewErrorPageAction($request, $code)); + } +} From 7bb1abe6f30505d2696d90936632ef9da8e88a7e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 21 Nov 2014 09:24:15 +0100 Subject: [PATCH 12/36] fixed typo --- .../Bundle/TwigBundle/Controller/ExceptionController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 395f69785f..38be248aad 100644 --- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -58,7 +58,7 @@ class ExceptionController public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null) { $currentContent = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1)); - $showException = $request->get('showException', $this->debug); // As opposed to an additional parameter, this maintains BC + $showException = $request->attributes->get('showException', $this->debug); // As opposed to an additional parameter, this maintains BC $code = $exception->getStatusCode(); From 0d20753e0e4d2f8c49465bcb4a56aec7f173e091 Mon Sep 17 00:00:00 2001 From: Stepan Anchugov Date: Tue, 21 Oct 2014 00:20:07 +0600 Subject: [PATCH 13/36] [DX] [Form] [WebProfiler] Added abbrs with type classes This adds an element having a descriptive title that displays the form element's type class name. --- .../WebProfilerBundle/Resources/views/Collector/form.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig index 736f718ccf..cd30a30a6b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig @@ -420,7 +420,7 @@ {% else %}
{% endif %} - {{ name }} + {{ name }} {% if data.type is not empty %}[{{ data.type }}]{% endif %} {% if data.errors is defined and data.errors|length > 0 %}
{{ data.errors|length }}
{% endif %} From 6e9642a9da5411d90b3f3a51b2f5eb0b27924a97 Mon Sep 17 00:00:00 2001 From: Stepan Anchugov Date: Mon, 27 Oct 2014 15:16:22 +0500 Subject: [PATCH 14/36] [Form][WebProfiler] Empty form names fix When a Form had no name, the markup was broken in the profiler, making the form tree ugly. --- .../Resources/views/Collector/form.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig index 6d6d07d240..43e706b0a7 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig @@ -420,7 +420,7 @@ {% else %}
{% endif %} - {{ name }} + {{ name|default('(no name)') }} {% if data.errors is defined and data.errors|length > 0 %}
{{ data.errors|length }}
{% endif %} @@ -437,9 +437,9 @@ {% endmacro %} {% macro form_tree_details(name, data, forms_by_hash) %} -
+

- {{ name }} + {{ name|default('(no name)') }} {% if data.type_class is defined %} [{{ data.type }}] {% endif %} From aec10e6a241397704168744837fbaa25d24ee13c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 21 Nov 2014 11:39:32 +0100 Subject: [PATCH 15/36] fixed typo --- .../Bundle/TwigBundle/Controller/ExceptionController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 38be248aad..1f0dd4bfef 100644 --- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -122,7 +122,7 @@ class ExceptionController // default to a generic HTML exception $request->setRequestFormat('html'); - return new TemplateReference('TwigBundle', 'Exception', $debug ? 'exception_full' : $name, 'html', 'twig'); + return new TemplateReference('TwigBundle', 'Exception', $this->debug ? 'exception_full' : $name, 'html', 'twig'); } // to be removed when the minimum required version of Twig is >= 2.0 From 83d768d09ef85e680ba639c4404c6f3f072b1f58 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 21 Nov 2014 15:47:53 +0100 Subject: [PATCH 16/36] be smarter when guessing the document root --- .../Command/ServerStartCommand.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php index 369567a9aa..c5ec95d4d4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php @@ -33,7 +33,7 @@ class ServerStartCommand extends ServerCommand $this ->setDefinition(array( new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'), - new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', 'web/'), + new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', null), new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'), )) ->setName('server:start') @@ -83,6 +83,18 @@ EOF return 1; } + $documentRoot = $input->getOption('docroot'); + + if (null === $documentRoot) { + $documentRoot = $this->getContainer()->getParameter('kernel.root_dir').'/../web'; + } + + if (!is_dir($documentRoot)) { + $output->writeln(sprintf('The given document root directory "%s" does not exist', $documentRoot)); + + return 1; + } + $env = $this->getContainer()->getParameter('kernel.environment'); if ('prod' === $env) { @@ -111,7 +123,7 @@ EOF return 1; } - if (null === $process = $this->createServerProcess($output, $address, $input->getOption('docroot'), $input->getOption('router'), $env, null)) { + if (null === $process = $this->createServerProcess($output, $address, $documentRoot, $input->getOption('router'), $env, null)) { return 1; } From b3db574a9f197c1e72e2ac2012cc93e3ee45beef Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 21 Nov 2014 16:18:07 +0100 Subject: [PATCH 17/36] properly set request attributes in controller test --- .../Bundle/TwigBundle/Controller/ExceptionController.php | 2 +- .../TwigBundle/Tests/Controller/ExceptionControllerTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 1f0dd4bfef..01deadc83b 100644 --- a/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -122,7 +122,7 @@ class ExceptionController // default to a generic HTML exception $request->setRequestFormat('html'); - return new TemplateReference('TwigBundle', 'Exception', $this->debug ? 'exception_full' : $name, 'html', 'twig'); + return new TemplateReference('TwigBundle', 'Exception', $showException ? 'exception_full' : $name, 'html', 'twig'); } // to be removed when the minimum required version of Twig is >= 2.0 diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php index 222ac32c9e..4a17902ae9 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php @@ -51,7 +51,8 @@ class ExceptionControllerTest extends TestCase )) ); - $request = Request::create('whatever', 'GET', array('showException' => false)); + $request = Request::create('whatever', 'GET'); + $request->attributes->set('showException', false); $exception = FlattenException::create(new \Exception(), 404); $controller = new ExceptionController($twig, /* "showException" defaults to --> */ true); From 41627138deb1e7ced288d1e2ffff907154690173 Mon Sep 17 00:00:00 2001 From: Korvin Szanto Date: Fri, 31 Oct 2014 09:35:48 -0700 Subject: [PATCH 18/36] Make `\Request::get` more performant. --- src/Symfony/Component/HttpFoundation/Request.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 5af12d38f8..7b9311e506 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -692,7 +692,17 @@ class Request */ public function get($key, $default = null, $deep = false) { - return $this->query->get($key, $this->attributes->get($key, $this->request->get($key, $default, $deep), $deep), $deep); + $result = $this->query($key, $this, $deep); + if ($result === $this) { + $result = $this->attributes->get($key, $this, $deep); + } + if ($result === $this) { + $result = $this->request->get($key, $this, $deep); + } + if ($result === $this) { + return $default; + } + return $result; } /** From ad6422304b7760af9bc0d1f4aae30ddaf9fbd4c6 Mon Sep 17 00:00:00 2001 From: Korvin Szanto Date: Fri, 31 Oct 2014 09:41:06 -0700 Subject: [PATCH 19/36] Fix typo --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 7b9311e506..904ee04f69 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -692,7 +692,7 @@ class Request */ public function get($key, $default = null, $deep = false) { - $result = $this->query($key, $this, $deep); + $result = $this->query->get($key, $this, $deep); if ($result === $this) { $result = $this->attributes->get($key, $this, $deep); } From 3039935997fde8f99258ee8a95fb6fa7fead3f60 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 21 Nov 2014 15:29:33 +0100 Subject: [PATCH 20/36] reformat code as suggested by @fabpot --- .../Component/HttpFoundation/Request.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 904ee04f69..5e3a2fe0f3 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -692,17 +692,19 @@ class Request */ public function get($key, $default = null, $deep = false) { - $result = $this->query->get($key, $this, $deep); - if ($result === $this) { - $result = $this->attributes->get($key, $this, $deep); + if ($this !== $result = $this->query->get($key, $this, $deep)) { + return $result; } - if ($result === $this) { - $result = $this->request->get($key, $this, $deep); + + if ($this !== $result = $this->attributes->get($key, $this, $deep)) { + return $result; } - if ($result === $this) { - return $default; + + if ($this !== $result = $this->request->get($key, $this, $deep)) { + return $result; } - return $result; + + return $default; } /** From 9a08b776a284822b686c1c29532b967160f51ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gre=CC=81gory=20Pelletier?= Date: Sun, 9 Nov 2014 08:01:39 +0100 Subject: [PATCH 21/36] Remove block submit_widget --- .../Twig/Resources/views/Form/bootstrap_3_layout.html.twig | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index e312da3f53..99c04d8a70 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -14,11 +14,6 @@ {{- parent() -}} {%- endblock textarea_widget %} -{% block submit_widget -%} - {% set attr = attr|merge({class: (attr.class|default('') ~ ' btn')|trim}) %} - {{- parent() -}} -{%- endblock %} - {% block button_widget -%} {% set attr = attr|merge({class: (attr.class|default('') ~ ' btn')|trim}) %} {{- parent() -}} From 2035fea2a8d5780241ef6ac70105ce87e43bf184 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 23 Nov 2014 20:04:20 +0100 Subject: [PATCH 22/36] remove an unneeded check It is already checked in the `isEnabled()` method if the current PHP build is HHVM and the `server:run` command is never enabled then. Thus, it's not needed to check for HHVM on every command execution. --- .../Bundle/FrameworkBundle/Command/ServerRunCommand.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 475dbeadc0..f125c36fa6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -83,12 +83,6 @@ EOF */ protected function execute(InputInterface $input, OutputInterface $output) { - if (defined('HHVM_VERSION')) { - $output->writeln('This command is not supported on HHVM.'); - - return 1; - } - $documentRoot = $input->getOption('docroot'); if (null === $documentRoot) { From 556eff1b54d5daf5ca9e1e23d78faa8663c1d280 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 23 Nov 2014 19:59:34 +0100 Subject: [PATCH 23/36] backport #12489 --- .../Command/ServerRunCommand.php | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 5f3ea5dffb..fb8b285fc6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -15,6 +15,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\ProcessBuilder; /** @@ -29,7 +30,7 @@ class ServerRunCommand extends ContainerAwareCommand */ public function isEnabled() { - if (PHP_VERSION_ID < 50400) { + if (PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) { return false; } @@ -99,24 +100,13 @@ EOF $output->writeln('Running PHP built-in server in production environment is NOT recommended!'); } - $router = $input->getOption('router') ?: $this - ->getContainer() - ->get('kernel') - ->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env)) - ; - - if (!file_exists($router)) { - $output->writeln(sprintf('The given router script "%s" does not exist', $router)); - + if (null === $builder = $this->createPhpProcessBuilder($input, $output, $env)) { return 1; } - $router = realpath($router); - $output->writeln(sprintf("Server running on http://%s\n", $input->getArgument('address'))); $output->writeln('Quit the server with CONTROL-C.'); - $builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router)); $builder->setWorkingDirectory($documentRoot); $builder->setTimeout(null); $process = $builder->getProcess(); @@ -136,4 +126,30 @@ EOF return $process->getExitCode(); } + + private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env) + { + $router = $input->getOption('router') ?: $this + ->getContainer() + ->get('kernel') + ->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env)) + ; + + if (!file_exists($router)) { + $output->writeln(sprintf('The given router script "%s" does not exist', $router)); + + return; + } + + $router = realpath($router); + $finder = new PhpExecutableFinder(); + + if (false === $binary = $finder->find()) { + $output->writeln('Unable to find PHP binary to run server'); + + return; + } + + return new ProcessBuilder(array($binary, '-S', $input->getArgument('address'), $router)); + } } From d2f846b45306d88387ee81e694e925d4ac643fa4 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 23 Nov 2014 21:10:39 +0100 Subject: [PATCH 24/36] compare version using PHP_VERSION_ID This continues the work started in #12497 on the `2.3` branch. --- .../FrameworkBundle/DependencyInjection/Configuration.php | 2 +- .../Tests/Console/Descriptor/JsonDescriptorTest.php | 2 +- .../Tests/DependencyInjection/ConfigurationTest.php | 2 +- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 6 +++--- src/Symfony/Component/ExpressionLanguage/Parser.php | 2 +- .../Tests/TokenStorage/NativeSessionTokenStorageTest.php | 2 +- .../Csrf/TokenStorage/NativeSessionTokenStorage.php | 2 +- .../Translation/Tests/Dumper/JsonFileDumperTest.php | 2 +- .../Tests/Validator/LegacyValidator2Dot5ApiTest.php | 2 +- .../Tests/Validator/LegacyValidatorLegacyApiTest.php | 2 +- .../Component/Validator/Tests/ValidatorBuilderTest.php | 4 ++-- src/Symfony/Component/Validator/ValidatorBuilder.php | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 6bc5e555fc..d430e302fc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -474,7 +474,7 @@ class Configuration implements ConfigurationInterface // API version already during container configuration // (to adjust service classes etc.) // See https://github.com/symfony/symfony/issues/11580 - $v['validation']['api'] = version_compare(PHP_VERSION, '5.3.9', '<') + $v['validation']['api'] = PHP_VERSION_ID < 50309 ? '2.4' : '2.5-bc'; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php index 5d6dafe46b..7f7a0ae15c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/JsonDescriptorTest.php @@ -17,7 +17,7 @@ class JsonDescriptorTest extends AbstractDescriptorTest { protected function setUp() { - if (version_compare(phpversion(), '5.4.0', '<')) { + if (PHP_VERSION_ID < 50400) { $this->markTestSkipped('Test skipped on PHP 5.3 as JSON_PRETTY_PRINT does not exist.'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index f2778fbd6a..8e40ee11fe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -129,7 +129,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase 'static_method' => array('loadValidatorMetadata'), 'translation_domain' => 'validators', 'strict_email' => false, - 'api' => version_compare(PHP_VERSION, '5.3.9', '<') ? '2.4' : '2.5-bc', + 'api' => PHP_VERSION_ID < 50309 ? '2.4' : '2.5-bc', ), 'annotations' => array( 'cache' => 'file', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index a05cb21bb4..07a337abd1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -280,7 +280,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]); $this->assertSame('setApiVersion', $calls[6][0]); - if (version_compare(PHP_VERSION, '5.3.9', '<')) { + if (PHP_VERSION_ID < 50309) { $this->assertEquals(array(Validation::API_VERSION_2_4), $calls[6][1]); } else { $this->assertEquals(array(Validation::API_VERSION_2_5_BC), $calls[6][1]); @@ -433,7 +433,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertSame('setApiVersion', $calls[5][0]); // no cache, no annotations - if (version_compare(PHP_VERSION, '5.3.9', '<')) { + if (PHP_VERSION_ID < 50309) { $this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]); } else { $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]); @@ -457,7 +457,7 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertSame('setApiVersion', $calls[5][0]); // no cache, no annotations - if (version_compare(PHP_VERSION, '5.3.9', '<')) { + if (PHP_VERSION_ID < 50309) { $this->assertSame(array(Validation::API_VERSION_2_4), $calls[5][1]); } else { $this->assertSame(array(Validation::API_VERSION_2_5_BC), $calls[5][1]); diff --git a/src/Symfony/Component/ExpressionLanguage/Parser.php b/src/Symfony/Component/ExpressionLanguage/Parser.php index e08568ceef..3e769c6d4f 100644 --- a/src/Symfony/Component/ExpressionLanguage/Parser.php +++ b/src/Symfony/Component/ExpressionLanguage/Parser.php @@ -336,7 +336,7 @@ class Parser $node = new Node\GetAttrNode($node, $arg, $arguments, $type); } elseif ('[' === $token->value) { - if ($node instanceof Node\GetAttrNode && Node\GetAttrNode::METHOD_CALL === $node->attributes['type'] && version_compare(PHP_VERSION, '5.4.0', '<')) { + if ($node instanceof Node\GetAttrNode && Node\GetAttrNode::METHOD_CALL === $node->attributes['type'] && PHP_VERSION_ID < 50400) { throw new SyntaxError('Array calls on a method call is only supported on PHP 5.4+', $token->cursor); } diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php index 724806c881..7ae27790e5 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php @@ -51,7 +51,7 @@ class NativeSessionTokenStorageTest extends \PHPUnit_Framework_TestCase public function testStoreTokenInClosedSessionWithExistingSessionId() { - if (version_compare(PHP_VERSION, '5.4', '<')) { + if (PHP_VERSION_ID < 50400) { $this->markTestSkipped('This test requires PHP 5.4 or later.'); } diff --git a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php index af5931b40b..bb1a417ad5 100644 --- a/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php +++ b/src/Symfony/Component/Security/Csrf/TokenStorage/NativeSessionTokenStorage.php @@ -108,7 +108,7 @@ class NativeSessionTokenStorage implements TokenStorageInterface private function startSession() { - if (version_compare(PHP_VERSION, '5.4', '>=')) { + if (PHP_VERSION_ID >= 50400) { if (PHP_SESSION_NONE === session_status()) { session_start(); } diff --git a/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php index acd2087fdb..697cd939f6 100644 --- a/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php +++ b/src/Symfony/Component/Translation/Tests/Dumper/JsonFileDumperTest.php @@ -18,7 +18,7 @@ class JsonFileDumperTest extends \PHPUnit_Framework_TestCase { public function testDump() { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { + if (PHP_VERSION_ID < 50400) { $this->markTestIncomplete('PHP below 5.4 doesn\'t support JSON pretty printing'); } diff --git a/src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php b/src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php index 7a00da6419..3e1e442f75 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/LegacyValidator2Dot5ApiTest.php @@ -21,7 +21,7 @@ class LegacyValidator2Dot5ApiTest extends Abstract2Dot5ApiTest { protected function setUp() { - if (version_compare(PHP_VERSION, '5.3.9', '<')) { + if (PHP_VERSION_ID < 50309) { $this->markTestSkipped('Not supported prior to PHP 5.3.9'); } diff --git a/src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php b/src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php index f803c636b9..3f02a5af71 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/LegacyValidatorLegacyApiTest.php @@ -21,7 +21,7 @@ class LegacyValidatorLegacyApiTest extends AbstractLegacyApiTest { protected function setUp() { - if (version_compare(PHP_VERSION, '5.3.9', '<')) { + if (PHP_VERSION_ID < 50309) { $this->markTestSkipped('Not supported prior to PHP 5.3.9'); } diff --git a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php index ed914d1394..ba184f7c78 100644 --- a/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php +++ b/src/Symfony/Component/Validator/Tests/ValidatorBuilderTest.php @@ -112,7 +112,7 @@ class ValidatorBuilderTest extends \PHPUnit_Framework_TestCase public function testDefaultApiVersion() { - if (version_compare(PHP_VERSION, '5.3.9', '<')) { + if (PHP_VERSION_ID < 50309) { // Old implementation on PHP < 5.3.9 $this->assertInstanceOf('Symfony\Component\Validator\Validator', $this->builder->getValidator()); } else { @@ -135,7 +135,7 @@ class ValidatorBuilderTest extends \PHPUnit_Framework_TestCase public function testSetApiVersion24And25() { - if (version_compare(PHP_VERSION, '5.3.9', '<')) { + if (PHP_VERSION_ID < 50309) { $this->markTestSkipped('Not supported prior to PHP 5.3.9'); } diff --git a/src/Symfony/Component/Validator/ValidatorBuilder.php b/src/Symfony/Component/Validator/ValidatorBuilder.php index ba6fa0c805..b4489f4c2b 100644 --- a/src/Symfony/Component/Validator/ValidatorBuilder.php +++ b/src/Symfony/Component/Validator/ValidatorBuilder.php @@ -325,7 +325,7 @@ class ValidatorBuilder implements ValidatorBuilderInterface )); } - if (version_compare(PHP_VERSION, '5.3.9', '<') && $apiVersion === Validation::API_VERSION_2_5_BC) { + if (PHP_VERSION_ID < 50309 && $apiVersion === Validation::API_VERSION_2_5_BC) { throw new InvalidArgumentException(sprintf( 'The Validator API that is compatible with both Symfony 2.4 '. 'and Symfony 2.5 can only be used on PHP 5.3.9 and higher. '. @@ -385,7 +385,7 @@ class ValidatorBuilder implements ValidatorBuilderInterface $apiVersion = $this->apiVersion; if (null === $apiVersion) { - $apiVersion = version_compare(PHP_VERSION, '5.3.9', '<') + $apiVersion = PHP_VERSION_ID < 50309 ? Validation::API_VERSION_2_4 : Validation::API_VERSION_2_5_BC; } From 58476e18140b1d76674dceacb4102250b2659fd7 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 23 Nov 2014 21:21:44 +0100 Subject: [PATCH 25/36] [Debug] fix ENT_SUBSTITUTE usage --- src/Symfony/Component/Debug/ExceptionHandler.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index a0d03236de..74346a5d00 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -384,11 +384,6 @@ EOF; */ private function formatArgs(array $args) { - if (PHP_VERSION_ID >= 50400) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; - } else { - $flags = ENT_QUOTES; - } $result = array(); foreach ($args as $key => $item) { if ('object' === $item[0]) { @@ -429,7 +424,7 @@ EOF; $str = iconv($charset, 'UTF-8', $str); } - return htmlspecialchars($str, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8'); } /** From da3d5d4036a99eb2ebcd22c371bf95194547004d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 23 Nov 2014 21:57:10 +0100 Subject: [PATCH 26/36] updated CHANGELOG for 2.6.0-BETA2 --- CHANGELOG-2.6.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG-2.6.md b/CHANGELOG-2.6.md index f6145e035e..016a7a7d1f 100644 --- a/CHANGELOG-2.6.md +++ b/CHANGELOG-2.6.md @@ -7,6 +7,25 @@ in 2.6 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.6.0...v2.6.1 +* 2.6.0-BETA2 (2014-11-23) + + * bug #12555 [Debug] fix ENT_SUBSTITUTE usage (nicolas-grekas) + * feature #12538 [FrameworkBundle] be smarter when guessing the document root (xabbuh) + * bug #12539 [TwigBundle] properly set request attributes in controller test (xabbuh) + * bug #12267 [Form][WebProfiler] Empty form names fix (kix) + * bug #12137 [FrameworkBundle] cache:clear command fills *.php.meta files with wrong data (Strate) + * bug #12525 [Bundle][FrameworkBundle] be smarter when guessing the document root (xabbuh) + * bug #12296 [SecurityBundle] Authentication entry point is only registered with firewall exception listener, not with authentication listeners (rjkip) + * bug #12446 [Twig/DebugBundle] move dump extension registration (nicolas-grekas) + * bug #12489 [FrameworkBundle] Fix server run in case the router script does not exist (romainneutron) + * feature #12404 [Form] Remove timezone options from DateType and TimeType (jakzal) + * bug #12487 [DomCrawler] Added support for 'link' tags in the Link class (StephaneSeng) + * bug #12490 [FrameworkBundle] Fix server start in case the PHP binary is not found (romainneutron) + * bug #12443 [HttpKernel] Adding support for invokable controllers in the RequestDataCollector (jameshalsall) + * bug #12393 [DependencyInjection] inlined factory not referenced (boekkooi) + * bug #12411 [VarDumper] Use Unicode Control Pictures (nicolas-grekas) + * bug #12436 [Filesystem] Fixed case for empty folder (yosmanyga) + * 2.6.0-BETA1 (2014-11-03) * first beta release From d56d198aa41e70058edbf660a7de0a0c02aa2faf Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 23 Nov 2014 21:57:16 +0100 Subject: [PATCH 27/36] updated VERSION for 2.6.0-BETA2 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index d3eed40a69..54b9be7525 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.6.0-DEV'; + const VERSION = '2.6.0-BETA2'; const VERSION_ID = '20600'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '6'; const RELEASE_VERSION = '0'; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = 'BETA2'; /** * Constructor. From 4a1a0ed6868bceb60d6a67035fb8499d8aa85e10 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 24 Nov 2014 08:41:00 +0100 Subject: [PATCH 28/36] bumped Symfony version to 2.6.0 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 54b9be7525..d3eed40a69 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.6.0-BETA2'; + const VERSION = '2.6.0-DEV'; const VERSION_ID = '20600'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '6'; const RELEASE_VERSION = '0'; - const EXTRA_VERSION = 'BETA2'; + const EXTRA_VERSION = 'DEV'; /** * Constructor. From 0a76b7e9fc2fcc0495312047f83843e041e28cfc Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 24 Nov 2014 13:25:40 +0100 Subject: [PATCH 29/36] Rename Symfony2 to Symfony --- CONTRIBUTING.md | 2 +- CONTRIBUTORS.md | 2 +- README.md | 22 +++++++++---------- src/Symfony/Bridge/Doctrine/README.md | 2 +- src/Symfony/Bridge/Monolog/README.md | 2 +- src/Symfony/Bridge/Propel1/README.md | 2 +- src/Symfony/Bridge/ProxyManager/README.md | 2 +- src/Symfony/Bridge/Twig/README.md | 2 +- .../Extension/TranslationExtensionTest.php | 22 +++++++++---------- .../Command/ServerRunCommand.php | 2 +- .../TwigBundle/Loader/FilesystemLoader.php | 2 +- .../views/Profiler/toolbar.html.twig | 4 ++-- .../Component/EventDispatcher/README.md | 2 +- .../Tests/Iterator/FilePathsIteratorTest.php | 2 +- .../Tests/Iterator/RealIteratorTestCase.php | 4 ++-- .../Csrf/CsrfProvider/SessionCsrfProvider.php | 2 +- .../Validator/ValidatorExtension.php | 2 +- .../Component/Form/Tests/FormConfigTest.php | 2 +- .../Storage/PhpBridgeSessionStorage.php | 2 +- .../Tests/Session/SessionTest.php | 6 ++--- .../Storage/NativeSessionStorageTest.php | 2 +- src/Symfony/Component/HttpKernel/README.md | 10 ++++----- src/Symfony/Component/Intl/CONTRIBUTING.md | 2 +- .../Intl/Resources/bin/update-data.php | 2 +- .../Tests/IdentityTranslatorTest.php | 4 ++-- .../Translation/Tests/TranslatorTest.php | 12 +++++----- .../Tests/fixtures/resourcebundle/dat/en.txt | 2 +- .../Tests/fixtures/resourcebundle/dat/fr.txt | 2 +- 28 files changed, 62 insertions(+), 62 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 383bec81f6..79cc6756b9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ Contributing ------------ -Symfony2 is an open source, community-driven project. If you'd like to contribute, +Symfony is an open source, community-driven project. If you'd like to contribute, please read the [Contributing Code][1] part of the documentation. If you're submitting a pull request, please follow the guidelines in the [Submitting a Patch][2] section and use the [Pull Request Template][3]. diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index cde155aa47..d85827540b 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,7 +1,7 @@ CONTRIBUTORS ============ -Symfony2 is the result of the work of many people who made the code better +Symfony is the result of the work of many people who made the code better (see http://symfony.com/contributors for more information): - Fabien Potencier (fabpot) diff --git a/README.md b/README.md index 8f04cd8650..42607fbbfa 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ README ====== -What is Symfony2? +What is Symfony? ----------------- -Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and +Symfony is a PHP 5.3 full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP. @@ -14,7 +14,7 @@ to high traffic ones like Dailymotion or Yahoo! Answers. Requirements ------------ -Symfony2 is only supported on PHP 5.3.3 and up. +Symfony is only supported on PHP 5.3.3 and up. Be warned that PHP versions before 5.3.8 are known to be buggy and might not work for you: @@ -28,35 +28,35 @@ work for you: known PHP bug (see https://bugs.php.net/bug.php?id=55156). * PHP 5.3.16 has a major bug in the Reflection subsystem and is not suitable to - run Symfony2 (https://bugs.php.net/bug.php?id=62715) + run Symfony (https://bugs.php.net/bug.php?id=62715) Installation ------------ -The best way to install Symfony2 is to download the Symfony Standard Edition +The best way to install Symfony is to download the Symfony Standard Edition available at [http://symfony.com/download][1]. Documentation ------------- The "[Quick Tour][2]" tutorial gives you a first feeling of the framework. If, -like us, you think that Symfony2 can help speed up your development and take +like us, you think that Symfony can help speed up your development and take the quality of your work to the next level, read the official -[Symfony2 documentation][3]. +[Symfony documentation][3]. Contributing ------------ -Symfony2 is an open source, community-driven project. If you'd like to contribute, +Symfony is an open source, community-driven project. If you'd like to contribute, please read the [Contributing Code][4] part of the documentation. If you're submitting a pull request, please follow the guidelines in the [Submitting a Patch][5] section and use [Pull Request Template][6]. -Running Symfony2 Tests +Running Symfony Tests ---------------------- -Information on how to run the Symfony2 test suite can be found in the -[Running Symfony2 Tests][7] section. +Information on how to run the Symfony test suite can be found in the +[Running Symfony Tests][7] section. [1]: http://symfony.com/download [2]: http://symfony.com/get_started diff --git a/src/Symfony/Bridge/Doctrine/README.md b/src/Symfony/Bridge/Doctrine/README.md index 2a97041a05..972ccbfc96 100644 --- a/src/Symfony/Bridge/Doctrine/README.md +++ b/src/Symfony/Bridge/Doctrine/README.md @@ -2,7 +2,7 @@ Doctrine Bridge =============== Provides integration for [Doctrine](http://www.doctrine-project.org/) with -various Symfony2 components. +various Symfony components. Resources --------- diff --git a/src/Symfony/Bridge/Monolog/README.md b/src/Symfony/Bridge/Monolog/README.md index f28c85b009..c666f1d150 100644 --- a/src/Symfony/Bridge/Monolog/README.md +++ b/src/Symfony/Bridge/Monolog/README.md @@ -1,7 +1,7 @@ Monolog Bridge ============== -Provides integration for Monolog with various Symfony2 components. +Provides integration for Monolog with various Symfony components. Resources --------- diff --git a/src/Symfony/Bridge/Propel1/README.md b/src/Symfony/Bridge/Propel1/README.md index 81a3388edf..22d0aa2a7a 100644 --- a/src/Symfony/Bridge/Propel1/README.md +++ b/src/Symfony/Bridge/Propel1/README.md @@ -1,7 +1,7 @@ Propel Bridge ============= -Provides integration for Propel with various Symfony2 components. +Provides integration for Propel with various Symfony components. Resources --------- diff --git a/src/Symfony/Bridge/ProxyManager/README.md b/src/Symfony/Bridge/ProxyManager/README.md index a266a26001..f2ce134241 100644 --- a/src/Symfony/Bridge/ProxyManager/README.md +++ b/src/Symfony/Bridge/ProxyManager/README.md @@ -1,7 +1,7 @@ ProxyManager Bridge =================== -Provides integration for [ProxyManager][1] with various Symfony2 components. +Provides integration for [ProxyManager][1] with various Symfony components. Resources --------- diff --git a/src/Symfony/Bridge/Twig/README.md b/src/Symfony/Bridge/Twig/README.md index 0e7c9608e4..c5053c860b 100644 --- a/src/Symfony/Bridge/Twig/README.md +++ b/src/Symfony/Bridge/Twig/README.md @@ -2,7 +2,7 @@ Twig Bridge =========== Provides integration for [Twig](http://twig.sensiolabs.org/) with various -Symfony2 components. +Symfony components. Resources --------- diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index a75f228860..4e03e8a004 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -89,13 +89,13 @@ class TranslationExtensionTest extends TestCase return array( // trans tag array('{% trans %}Hello{% endtrans %}', 'Hello'), - array('{% trans %}%name%{% endtrans %}', 'Symfony2', array('name' => 'Symfony2')), + array('{% trans %}%name%{% endtrans %}', 'Symfony', array('name' => 'Symfony')), array('{% trans from elsewhere %}Hello{% endtrans %}', 'Hello'), - array('{% trans %}Hello %name%{% endtrans %}', 'Hello Symfony2', array('name' => 'Symfony2')), - array('{% trans with { \'%name%\': \'Symfony2\' } %}Hello %name%{% endtrans %}', 'Hello Symfony2'), - array('{% set vars = { \'%name%\': \'Symfony2\' } %}{% trans with vars %}Hello %name%{% endtrans %}', 'Hello Symfony2'), + array('{% trans %}Hello %name%{% endtrans %}', 'Hello Symfony', array('name' => 'Symfony')), + array('{% trans with { \'%name%\': \'Symfony\' } %}Hello %name%{% endtrans %}', 'Hello Symfony'), + array('{% set vars = { \'%name%\': \'Symfony\' } %}{% trans with vars %}Hello %name%{% endtrans %}', 'Hello Symfony'), array('{% trans into "fr"%}Hello{% endtrans %}', 'Hello'), @@ -105,9 +105,9 @@ class TranslationExtensionTest extends TestCase array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', 'There is 5 apples', array('count' => 5),), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony2)', array('count' => 5, 'name' => 'Symfony2'),), - array('{% transchoice count with { \'%name%\': \'Symfony2\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony2)', array('count' => 5),), + 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony'),), + array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', + 'There is 5 apples (Symfony)', array('count' => 5),), array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', 'There is no apples', array('count' => 0),), array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', @@ -115,14 +115,14 @@ class TranslationExtensionTest extends TestCase // trans filter array('{{ "Hello"|trans }}', 'Hello'), - array('{{ name|trans }}', 'Symfony2', array('name' => 'Symfony2')), - array('{{ hello|trans({ \'%name%\': \'Symfony2\' }) }}', 'Hello Symfony2', array('hello' => 'Hello %name%')), - array('{% set vars = { \'%name%\': \'Symfony2\' } %}{{ hello|trans(vars) }}', 'Hello Symfony2', array('hello' => 'Hello %name%')), + array('{{ name|trans }}', 'Symfony', array('name' => 'Symfony')), + array('{{ hello|trans({ \'%name%\': \'Symfony\' }) }}', 'Hello Symfony', array('hello' => 'Hello %name%')), + array('{% set vars = { \'%name%\': \'Symfony\' } %}{{ hello|trans(vars) }}', 'Hello Symfony', array('hello' => 'Hello %name%')), array('{{ "Hello"|trans({}, "messages", "fr") }}', 'Hello'), // transchoice filter array('{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|transchoice(count) }}', 'There is 5 apples', array('count' => 5)), - array('{{ text|transchoice(5, {\'%name%\': \'Symfony2\'}) }}', 'There is 5 apples (Symfony2)', array('text' => '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%)')), + array('{{ text|transchoice(5, {\'%name%\': \'Symfony\'}) }}', 'There is 5 apples (Symfony)', array('text' => '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%)')), array('{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|transchoice(count, {}, "messages", "fr") }}', 'There is 5 apples', array('count' => 5)), ); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 5f3ea5dffb..f07e4d540c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -18,7 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; /** - * Runs Symfony2 application using PHP built-in web server + * Runs Symfony application using PHP built-in web server. * * @author Michał Pipa */ diff --git a/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php index 3793e66df4..fe0fbe15f3 100644 --- a/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php +++ b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php @@ -17,7 +17,7 @@ use Symfony\Component\Templating\TemplateReferenceInterface; /** * FilesystemLoader extends the default Twig filesystem loader - * to work with the Symfony2 paths. + * to work with the Symfony paths and template references. * * @author Fabien Potencier */ diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig index 1170b9c4b5..9e96dc6d1a 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig @@ -1,4 +1,4 @@ - + {% if 'normal' != position %}
{% endif %}
- + diff --git a/src/Symfony/Component/EventDispatcher/README.md b/src/Symfony/Component/EventDispatcher/README.md index c928f13669..0fbc35e2a4 100644 --- a/src/Symfony/Component/EventDispatcher/README.md +++ b/src/Symfony/Component/EventDispatcher/README.md @@ -1,7 +1,7 @@ EventDispatcher Component ========================= -The Symfony2 EventDispatcher component implements the Mediator pattern in a +The Symfony EventDispatcher component implements the Mediator pattern in a simple and effective way to make your projects truly extensible. ```php diff --git a/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php index d2f0e245f6..89853a85cb 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php @@ -31,7 +31,7 @@ class FilePathsIteratorTest extends RealIteratorTestCase public function getSubPathData() { - $tmpDir = sys_get_temp_dir().'/symfony2_finder'; + $tmpDir = sys_get_temp_dir().'/symfony_finder'; return array( array( diff --git a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php index 2a7383dc0a..e22476dad2 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php @@ -18,7 +18,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase public static function setUpBeforeClass() { - self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony2_finder'; + self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder'; self::$files = array( '.git/', @@ -74,7 +74,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase * Without the call to setUpBeforeClass() property can be null. */ if (!self::$tmpDir) { - self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony2_finder'; + self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder'; } if (is_array($files)) { diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php index ea1fa58547..52c9685ee1 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider; use Symfony\Component\HttpFoundation\Session\Session; /** - * This provider uses a Symfony2 Session object to retrieve the user's + * This provider uses a Symfony Session object to retrieve the user's * session ID. * * @see DefaultCsrfProvider diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php index 572a4ac938..9affa1a4d7 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php +++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php @@ -17,7 +17,7 @@ use Symfony\Component\Validator\ValidatorInterface; use Symfony\Component\Validator\Constraints\Valid; /** - * Extension supporting the Symfony2 Validator component in forms. + * Extension supporting the Symfony Validator component in forms. * * @author Bernhard Schussek */ diff --git a/src/Symfony/Component/Form/Tests/FormConfigTest.php b/src/Symfony/Component/Form/Tests/FormConfigTest.php index 961dfd3367..b77632c505 100644 --- a/src/Symfony/Component/Form/Tests/FormConfigTest.php +++ b/src/Symfony/Component/Form/Tests/FormConfigTest.php @@ -49,7 +49,7 @@ class FormConfigTest extends \PHPUnit_Framework_TestCase array('9', true), // Contrary to the HTML4 spec, we allow names starting with an // underscore, since this is already a widely used practice in - // Symfony2. + // Symfony. // For root forms, leading underscores will be stripped from the // "id" attribute to produce valid HTML4. array('_', true), diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php index f70b5e6227..6b5ad65056 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/PhpBridgeSessionStorage.php @@ -15,7 +15,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; /** - * Allows session to be started by PHP and managed by Symfony2 + * Allows session to be started by PHP and managed by Symfony * * @author Drak */ diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 56015fdf5a..c8a0183513 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -136,7 +136,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase return array( array('foo', 'bar', array('foo' => 'bar')), array('foo.bar', 'too much beer', array('foo.bar' => 'too much beer')), - array('great', 'symfony2 is great', array('great' => 'symfony2 is great')), + array('great', 'symfony is great', array('great' => 'symfony is great')), ); } @@ -195,7 +195,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase */ public function testGetIterator() { - $attributes = array('hello' => 'world', 'symfony2' => 'rocks'); + $attributes = array('hello' => 'world', 'symfony' => 'rocks'); foreach ($attributes as $key => $val) { $this->session->set($key, $val); } @@ -215,7 +215,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase public function testGetCount() { $this->session->set('hello', 'world'); - $this->session->set('symfony2', 'rocks'); + $this->session->set('symfony', 'rocks'); $this->assertCount(2, $this->session); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index ca8d28e337..1e79812118 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -137,7 +137,7 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase $options = array( 'cookie_lifetime' => 123456, 'cookie_path' => '/my/cookie/path', - 'cookie_domain' => 'symfony2.example.com', + 'cookie_domain' => 'symfony.example.com', 'cookie_secure' => true, 'cookie_httponly' => false, ); diff --git a/src/Symfony/Component/HttpKernel/README.md b/src/Symfony/Component/HttpKernel/README.md index 8c3c32c244..0830eb0bb5 100644 --- a/src/Symfony/Component/HttpKernel/README.md +++ b/src/Symfony/Component/HttpKernel/README.md @@ -4,7 +4,7 @@ HttpKernel Component HttpKernel provides the building blocks to create flexible and fast HTTP-based frameworks. -``HttpKernelInterface`` is the core interface of the Symfony2 full-stack +``HttpKernelInterface`` is the core interface of the Symfony full-stack framework: ```php @@ -23,11 +23,11 @@ interface HttpKernelInterface It takes a ``Request`` as an input and should return a ``Response`` as an output. Using this interface makes your code compatible with all frameworks -using the Symfony2 components. And this will give you many cool features for +using the Symfony components. And this will give you many cool features for free. -Creating a framework based on the Symfony2 components is really easy. Here is -a very simple, but fully-featured framework based on the Symfony2 components: +Creating a framework based on the Symfony components is really easy. Here is +a very simple, but fully-featured framework based on the Symfony components: ```php $routes = new RouteCollection(); @@ -54,7 +54,7 @@ $kernel = new HttpKernel($dispatcher, $resolver); $kernel->handle($request)->send(); ``` -This is all you need to create a flexible framework with the Symfony2 +This is all you need to create a flexible framework with the Symfony components. Want to add an HTTP reverse proxy and benefit from HTTP caching and Edge Side diff --git a/src/Symfony/Component/Intl/CONTRIBUTING.md b/src/Symfony/Component/Intl/CONTRIBUTING.md index 315c28ab6e..0657e12019 100644 --- a/src/Symfony/Component/Intl/CONTRIBUTING.md +++ b/src/Symfony/Component/Intl/CONTRIBUTING.md @@ -88,4 +88,4 @@ Once it is, the following steps have to be followed to build the .dat-file: $ rm -rf build packagelist.txt -3. You can now move region.dat to replace the version bundled with Symfony2. +3. You can now move region.dat to replace the version bundled with Symfony. diff --git a/src/Symfony/Component/Intl/Resources/bin/update-data.php b/src/Symfony/Component/Intl/Resources/bin/update-data.php index 74e3ee3b79..5fa5b6a622 100644 --- a/src/Symfony/Component/Intl/Resources/bin/update-data.php +++ b/src/Symfony/Component/Intl/Resources/bin/update-data.php @@ -38,7 +38,7 @@ if ($argc > 3 || 2 === $argc && '-h' === $argv[1]) { bailout(<< -Updates the ICU data for Symfony2 to the latest version of ICU. +Updates the ICU data for Symfony to the latest version of ICU. If you downloaded the SVN repository before, you can pass the path to the repository source in the first optional argument. diff --git a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php index cfd282a294..76db452abc 100644 --- a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php @@ -75,8 +75,8 @@ class IdentityTranslatorTest extends \PHPUnit_Framework_TestCase public function getTransTests() { return array( - array('Symfony2 is great!', 'Symfony2 is great!', array()), - array('Symfony2 is awesome!', 'Symfony2 is %what%!', array('%what%' => 'awesome')), + array('Symfony is great!', 'Symfony is great!', array()), + array('Symfony is awesome!', 'Symfony is %what%!', array('%what%' => 'awesome')), ); } diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php index 3fa87161d0..5538f4e81e 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php @@ -344,18 +344,18 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase public function getTransTests() { return array( - array('Symfony2 est super !', 'Symfony2 is great!', 'Symfony2 est super !', array(), 'fr', ''), - array('Symfony2 est awesome !', 'Symfony2 is %what%!', 'Symfony2 est %what% !', array('%what%' => 'awesome'), 'fr', ''), - array('Symfony2 est super !', new String('Symfony2 is great!'), 'Symfony2 est super !', array(), 'fr', ''), + array('Symfony est super !', 'Symfony is great!', 'Symfony est super !', array(), 'fr', ''), + array('Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', array('%what%' => 'awesome'), 'fr', ''), + array('Symfony est super !', new String('Symfony is great!'), 'Symfony est super !', array(), 'fr', ''), ); } public function getFlattenedTransTests() { $messages = array( - 'symfony2' => array( + 'symfony' => array( 'is' => array( - 'great' => 'Symfony2 est super!', + 'great' => 'Symfony est super!', ), ), 'foo' => array( @@ -367,7 +367,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase ); return array( - array('Symfony2 est super!', $messages, 'symfony2.is.great'), + array('Symfony est super!', $messages, 'symfony.is.great'), array('Foo Bar Baz', $messages, 'foo.bar.baz'), array('Foo Baz', $messages, 'foo.baz'), ); diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt b/src/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt index c04a4e8522..3d9e9eae1c 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt +++ b/src/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/en.txt @@ -1,3 +1,3 @@ en{ - symfony{"Symfony 2 is great"} + symfony{"Symfony is great"} } \ No newline at end of file diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt b/src/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt index 7e84f67ae0..182d0a0de3 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt +++ b/src/Symfony/Component/Translation/Tests/fixtures/resourcebundle/dat/fr.txt @@ -1,3 +1,3 @@ fr{ - symfony{"Symfony 2 est génial"} + symfony{"Symfony est génial"} } \ No newline at end of file From 1c6f5a1c8919383c02241ac8efdb814ccff1825a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 24 Nov 2014 19:24:01 +0100 Subject: [PATCH 30/36] fix data type in docblock --- .../Http/Authentication/CustomAuthenticationSuccessHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Http/Authentication/CustomAuthenticationSuccessHandler.php b/src/Symfony/Component/Security/Http/Authentication/CustomAuthenticationSuccessHandler.php index abbb81b0f8..2d1b26ebb9 100644 --- a/src/Symfony/Component/Security/Http/Authentication/CustomAuthenticationSuccessHandler.php +++ b/src/Symfony/Component/Security/Http/Authentication/CustomAuthenticationSuccessHandler.php @@ -24,7 +24,7 @@ class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandler /** * Constructor. * - * @param AuthenticationSuccessHandlerInterface $handler An AuthenticationFailureHandlerInterface instance + * @param AuthenticationSuccessHandlerInterface $handler An AuthenticationSuccessHandlerInterface instance * @param array $options Options for processing a successful authentication attempt * @param string $providerKey The provider key */ From a18b6d17e32a025f67287122d084bb19a4b198e8 Mon Sep 17 00:00:00 2001 From: Daniel Wehner Date: Tue, 25 Nov 2014 10:00:53 +0100 Subject: [PATCH 31/36] Fix initialized() with aliased services --- src/Symfony/Component/DependencyInjection/Container.php | 4 ++++ .../Component/DependencyInjection/Tests/ContainerTest.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 0d1be8f051..f5f61e5a82 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -365,6 +365,10 @@ class Container implements IntrospectableContainerInterface return true; } + if (isset($this->aliases[$id])) { + $id = $this->aliases[$id]; + } + return isset($this->services[$id]) || array_key_exists($id, $this->services); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index 314f3e61f1..8bc530c005 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -272,6 +272,10 @@ class ContainerTest extends \PHPUnit_Framework_TestCase $this->assertTrue($sc->initialized('foo'), '->initialized() returns true if service is loaded'); $this->assertFalse($sc->initialized('foo1'), '->initialized() returns false if service is not loaded'); $this->assertFalse($sc->initialized('bar'), '->initialized() returns false if a service is defined, but not currently loaded'); + $this->assertFalse($sc->initialized('alias'), '->initialized() returns false if an aliased service is not initialized'); + + $sc->set('bar', new \stdClass()); + $this->assertTrue($sc->initialized('alias'), '->initialized() returns true for alias if aliased service is initialized'); } public function testEnterLeaveCurrentScope() From d3451fc9388efbe324294f9a8d10fb2b1d56b73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Macias?= Date: Tue, 25 Nov 2014 23:48:05 +0100 Subject: [PATCH 32/36] [WebProfilerBundle] Remove usage of app.request in search bar template --- .../Bundle/WebProfilerBundle/Controller/ProfilerController.php | 1 + .../WebProfilerBundle/Resources/views/Profiler/search.html.twig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 604890cc53..ef99e99dc0 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -249,6 +249,7 @@ class ProfilerController 'start' => $start, 'end' => $end, 'limit' => $limit, + 'request' => $request, )), 200, array('Content-Type' => 'text/html')); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/search.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/search.html.twig index d9771d1739..8f06fa43e5 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/search.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/search.html.twig @@ -15,7 +15,7 @@
- +
From cd55a81df7633a3848680a47a5805889cbf4f122 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Wed, 26 Nov 2014 14:38:05 +0100 Subject: [PATCH 33/36] Upgrade information for the Translation component regarding the new LoggingTranslator class. --- UPGRADE-2.6.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/UPGRADE-2.6.md b/UPGRADE-2.6.md index e01a1dc3ca..fe0dc4839c 100644 --- a/UPGRADE-2.6.md +++ b/UPGRADE-2.6.md @@ -364,3 +364,43 @@ $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); Then enjoy dumping variables by calling `dump($var)` anywhere in your PHP and `{% dump var %}` or `{{ dump(var) }}` in Twig. Dumps are displayed **in the web debug toolbar**. + +Translation +----------- + +With `LoggingTranslator`, a new translator class is introduced with Symfony +2.6. By default, the `@translator` service is referring to this class in the +debug environment. + +If you have own services that depend on the `@translator` service and expect +this service to be an instance of either +`Symfony\Component\Translation\Translator` or +`Symfony\Bundle\FrameworkBundle\Translation\Translator`, e.g. by type-hinting +for either of these classes, you will need to change that type hint. You can +use the `TranslatorInterface` to be on the safe side for future changes. + +Before: + +```php +use Symfony\Component\Translation\Translator; + +class MyService { + public function __construct(Translator $translator) + { + ... + } +} +``` + +After: + +```php +use Symfony\Component\Translation\TranslatorInterface; + +class MyService { + public function __construct(TranslatorInterface $translator) + { + ... + } +} +``` From 680fe7acb2f40d40d62a558917e894365696acf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Macias?= Date: Wed, 26 Nov 2014 15:11:30 +0100 Subject: [PATCH 34/36] [RFC] [DebugBundle] [HttpKernel] Avoid using container as dependency for DumpListener --- .../DebugBundle/Resources/config/services.xml | 4 +- .../HttpKernel/EventListener/DumpListener.php | 28 +++++------ .../Tests/EventListener/DumpListenerTest.php | 46 ++++++------------- 3 files changed, 28 insertions(+), 50 deletions(-) diff --git a/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml b/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml index 14da81c3dd..798e8b78ec 100644 --- a/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml @@ -18,8 +18,8 @@ - - data_collector.dump + + diff --git a/src/Symfony/Component/HttpKernel/EventListener/DumpListener.php b/src/Symfony/Component/HttpKernel/EventListener/DumpListener.php index 46833959b2..c7f2daf218 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DumpListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DumpListener.php @@ -11,9 +11,10 @@ namespace Symfony\Component\HttpKernel\EventListener; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\VarDumper\Cloner\ClonerInterface; +use Symfony\Component\VarDumper\Dumper\DataDumperInterface; use Symfony\Component\VarDumper\VarDumper; /** @@ -27,30 +28,23 @@ class DumpListener implements EventSubscriberInterface private $dumper; /** - * @param ContainerInterface $container Service container, for lazy loading. - * @param string $dumper var_dumper dumper service to use. + * @param ClonerInterface $cloner Cloner service. + * @param DataDumperInterface $dumper Dumper service. */ - public function __construct(ContainerInterface $container, $dumper) + public function __construct(ClonerInterface $cloner, DataDumperInterface $dumper) { - $this->container = $container; + $this->cloner = $cloner; $this->dumper = $dumper; } public function configure() { - if ($this->container) { - $container = $this->container; - $dumper = $this->dumper; - $this->container = null; + $cloner = $this->cloner; + $dumper = $this->dumper; - VarDumper::setHandler(function ($var) use ($container, $dumper) { - $dumper = $container->get($dumper); - $cloner = $container->get('var_dumper.cloner'); - $handler = function ($var) use ($dumper, $cloner) {$dumper->dump($cloner->cloneVar($var));}; - VarDumper::setHandler($handler); - $handler($var); - }); - } + VarDumper::setHandler(function ($var) use ($cloner, $dumper) { + $dumper->dump($cloner->cloneVar($var)); + }); } public static function getSubscribedEvents() diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php index c665df563d..a9b715bacc 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/DumpListenerTest.php @@ -11,10 +11,11 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpKernel\EventListener\DumpListener; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\VarDumper\Cloner\ClonerInterface; +use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarDumper\Dumper\DataDumperInterface; use Symfony\Component\VarDumper\VarDumper; /** @@ -34,34 +35,23 @@ class DumpListenerTest extends \PHPUnit_Framework_TestCase public function testConfigure() { - $prevDumper = $this->getDumpHandler(); + $prevDumper = VarDumper::setHandler('var_dump'); + VarDumper::setHandler($prevDumper); - $container = new ContainerBuilder(); - $container->setDefinition('var_dumper.cloner', new Definition('Symfony\Component\HttpKernel\Tests\EventListener\MockCloner')); - $container->setDefinition('mock_dumper', new Definition('Symfony\Component\HttpKernel\Tests\EventListener\MockDumper')); + $cloner = new MockCloner(); + $dumper = new MockDumper(); ob_start(); $exception = null; - $listener = new DumpListener($container, 'mock_dumper'); + $listener = new DumpListener($cloner, $dumper); try { $listener->configure(); - $lazyDumper = $this->getDumpHandler(); VarDumper::dump('foo'); - - $loadedDumper = $this->getDumpHandler(); VarDumper::dump('bar'); $this->assertSame('+foo-+bar-', ob_get_clean()); - - $listenerReflector = new \ReflectionClass($listener); - $lazyReflector = new \ReflectionFunction($lazyDumper); - $loadedReflector = new \ReflectionFunction($loadedDumper); - - $this->assertSame($listenerReflector->getFilename(), $lazyReflector->getFilename()); - $this->assertSame($listenerReflector->getFilename(), $loadedReflector->getFilename()); - $this->assertGreaterThan($lazyReflector->getStartLine(), $loadedReflector->getStartLine()); } catch (\Exception $exception) { } @@ -71,28 +61,22 @@ class DumpListenerTest extends \PHPUnit_Framework_TestCase throw $exception; } } - - private function getDumpHandler() - { - $prevDumper = VarDumper::setHandler('var_dump'); - VarDumper::setHandler($prevDumper ); - - return $prevDumper; - } } -class MockCloner +class MockCloner implements ClonerInterface { public function cloneVar($var) { - return $var.'-'; + return new Data(array($var.'-')); } } -class MockDumper +class MockDumper implements DataDumperInterface { - public function dump($var) + public function dump(Data $data) { - echo '+'.$var; + $rawData = $data->getRawData(); + + echo '+'.$rawData[0]; } } From b753218ff536749c19dfc3a445766ab0d592836a Mon Sep 17 00:00:00 2001 From: Hugo Hamon Date: Sat, 8 Nov 2014 23:51:59 +0100 Subject: [PATCH 35/36] [Validator] make DateTime objects represented as strings in the violation message. --- .../Validator/Constraints/RangeValidator.php | 6 +- .../Tests/Constraints/RangeValidatorTest.php | 64 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/RangeValidator.php b/src/Symfony/Component/Validator/Constraints/RangeValidator.php index c0bde2b723..ebae112a3a 100644 --- a/src/Symfony/Component/Validator/Constraints/RangeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/RangeValidator.php @@ -35,7 +35,7 @@ class RangeValidator extends ConstraintValidator if (!is_numeric($value) && !$value instanceof \DateTime && !$value instanceof \DateTimeInterface) { $this->buildViolation($constraint->invalidMessage) - ->setParameter('{{ value }}', $this->formatValue($value)) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) ->setCode(Range::INVALID_VALUE_ERROR) ->addViolation(); @@ -61,7 +61,7 @@ class RangeValidator extends ConstraintValidator if (null !== $constraint->max && $value > $max) { $this->buildViolation($constraint->maxMessage) - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) ->setParameter('{{ limit }}', $this->formatValue($max, self::PRETTY_DATE)) ->setCode(Range::BEYOND_RANGE_ERROR) ->addViolation(); @@ -71,7 +71,7 @@ class RangeValidator extends ConstraintValidator if (null !== $constraint->min && $value < $min) { $this->buildViolation($constraint->minMessage) - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $this->formatValue($value, self::PRETTY_DATE)) ->setParameter('{{ limit }}', $this->formatValue($min, self::PRETTY_DATE)) ->setCode(Range::BELOW_RANGE_ERROR) ->addViolation(); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php index 3bfb405e07..9b7056b548 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php @@ -52,20 +52,20 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest public function getLessThanTen() { return array( - array(9.99999), - array('9.99999'), - array(5), - array(1.0), + array(9.99999, '9.99999'), + array('9.99999', '"9.99999"'), + array(5, '5'), + array(1.0, '1.0'), ); } public function getMoreThanTwenty() { return array( - array(20.000001), - array('20.000001'), - array(21), - array(30.0), + array(20.000001, '20.000001'), + array('20.000001', '"20.000001"'), + array(21, '21'), + array(30.0, '30.0'), ); } @@ -105,7 +105,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest /** * @dataProvider getLessThanTen */ - public function testInvalidValuesMin($value) + public function testInvalidValuesMin($value, $formattedValue) { $constraint = new Range(array( 'min' => 10, @@ -115,7 +115,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($value, $constraint); $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $formattedValue) ->setParameter('{{ limit }}', 10) ->setCode(Range::BELOW_RANGE_ERROR) ->assertRaised(); @@ -124,7 +124,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest /** * @dataProvider getMoreThanTwenty */ - public function testInvalidValuesMax($value) + public function testInvalidValuesMax($value, $formattedValue) { $constraint = new Range(array( 'max' => 20, @@ -134,7 +134,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($value, $constraint); $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $formattedValue) ->setParameter('{{ limit }}', 20) ->setCode(Range::BEYOND_RANGE_ERROR) ->assertRaised(); @@ -143,7 +143,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest /** * @dataProvider getMoreThanTwenty */ - public function testInvalidValuesCombinedMax($value) + public function testInvalidValuesCombinedMax($value, $formattedValue) { $constraint = new Range(array( 'min' => 10, @@ -155,7 +155,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($value, $constraint); $this->buildViolation('myMaxMessage') - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $formattedValue) ->setParameter('{{ limit }}', 20) ->setCode(Range::BEYOND_RANGE_ERROR) ->assertRaised(); @@ -164,7 +164,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest /** * @dataProvider getLessThanTen */ - public function testInvalidValuesCombinedMin($value) + public function testInvalidValuesCombinedMin($value, $formattedValue) { $constraint = new Range(array( 'min' => 10, @@ -176,7 +176,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($value, $constraint); $this->buildViolation('myMinMessage') - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $formattedValue) ->setParameter('{{ limit }}', 10) ->setCode(Range::BELOW_RANGE_ERROR) ->assertRaised(); @@ -212,13 +212,13 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->setDefaultTimezone('UTC'); $tests = array( - array(new \DateTime('March 20, 2013')), - array(new \DateTime('March 9, 2014')), + array(new \DateTime('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'), + array(new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'), ); if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $tests[] = array(new \DateTimeImmutable('March 20, 2013')); - $tests[] = array(new \DateTimeImmutable('March 9, 2014')); + $tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM'); + $tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'); } $this->restoreDefaultTimezone(); @@ -233,13 +233,13 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->setDefaultTimezone('UTC'); $tests = array( - array(new \DateTime('March 21, 2014')), - array(new \DateTime('March 9, 2015')), + array(new \DateTime('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'), + array(new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'), ); if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $tests[] = array(new \DateTimeImmutable('March 21, 2014')); - $tests[] = array(new \DateTimeImmutable('March 9, 2015')); + $tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM'); + $tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'); } $this->restoreDefaultTimezone(); @@ -283,7 +283,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest /** * @dataProvider getSoonerThanTenthMarch2014 */ - public function testInvalidDatesMin($value) + public function testInvalidDatesMin($value, $dateTimeAsString) { // Conversion of dates to string differs between ICU versions // Make sure we have the correct version loaded @@ -297,7 +297,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($value, $constraint); $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $dateTimeAsString) ->setParameter('{{ limit }}', 'Mar 10, 2014, 12:00 AM') ->setCode(Range::BELOW_RANGE_ERROR) ->assertRaised(); @@ -306,7 +306,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest /** * @dataProvider getLaterThanTwentiethMarch2014 */ - public function testInvalidDatesMax($value) + public function testInvalidDatesMax($value, $dateTimeAsString) { // Conversion of dates to string differs between ICU versions // Make sure we have the correct version loaded @@ -320,7 +320,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($value, $constraint); $this->buildViolation('myMessage') - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $dateTimeAsString) ->setParameter('{{ limit }}', 'Mar 20, 2014, 12:00 AM') ->setCode(Range::BEYOND_RANGE_ERROR) ->assertRaised(); @@ -329,7 +329,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest /** * @dataProvider getLaterThanTwentiethMarch2014 */ - public function testInvalidDatesCombinedMax($value) + public function testInvalidDatesCombinedMax($value, $dateTimeAsString) { // Conversion of dates to string differs between ICU versions // Make sure we have the correct version loaded @@ -345,7 +345,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($value, $constraint); $this->buildViolation('myMaxMessage') - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $dateTimeAsString) ->setParameter('{{ limit }}', 'Mar 20, 2014, 12:00 AM') ->setCode(Range::BEYOND_RANGE_ERROR) ->assertRaised(); @@ -354,7 +354,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest /** * @dataProvider getSoonerThanTenthMarch2014 */ - public function testInvalidDatesCombinedMin($value) + public function testInvalidDatesCombinedMin($value, $dateTimeAsString) { // Conversion of dates to string differs between ICU versions // Make sure we have the correct version loaded @@ -370,7 +370,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($value, $constraint); $this->buildViolation('myMinMessage') - ->setParameter('{{ value }}', $value) + ->setParameter('{{ value }}', $dateTimeAsString) ->setParameter('{{ limit }}', 'Mar 10, 2014, 12:00 AM') ->setCode(Range::BELOW_RANGE_ERROR) ->assertRaised(); From 1ed7606c3247ad73c1a8dd4a4d2bdfa9158c391f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 23 Nov 2014 21:05:05 +0100 Subject: [PATCH 36/36] [Debug] fix error message on double exception --- src/Symfony/Component/Debug/ExceptionHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index c7864dc961..cd7c51bdad 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -169,7 +169,7 @@ EOF } catch (\Exception $e) { // something nasty happened and we cannot throw an exception anymore if ($this->debug) { - $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($exception), $exception->getMessage()); + $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $e->getMessage()); } else { $title = 'Whoops, looks like something went wrong.'; }