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) 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) 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 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ce486c92ec..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) @@ -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 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/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) + { + ... + } +} +``` 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/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() -}} diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index cecedc37dc..777000efd1 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -75,13 +75,13 @@ class TranslationExtensionTest extends \PHPUnit_Framework_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'), @@ -91,9 +91,9 @@ class TranslationExtensionTest extends \PHPUnit_Framework_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 %}', @@ -101,14 +101,14 @@ class TranslationExtensionTest extends \PHPUnit_Framework_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/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/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index d538ae6f87..7843e7ddd3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -127,6 +127,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) { @@ -162,6 +165,9 @@ EOF file_put_contents(str_replace($search, $replace, $file), $content); unlink($file); } + + // remove temp kernel file after cache warmed up + @unlink($tempKernelFile); } /** @@ -201,13 +207,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/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 8477720efc..3b2efc139a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -19,7 +19,7 @@ use Symfony\Component\Process\PhpExecutableFinder; 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 */ @@ -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) { 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; } diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index adef4ade68..ab9a3312c8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -498,7 +498,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/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 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 2231a5f255..9a4ad2770a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -131,7 +131,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 b87807b323..acc3cff6ba 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -295,7 +295,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]); @@ -448,7 +448,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]); @@ -472,7 +472,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/Bundle/TwigBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 1bd758de5b..01deadc83b 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->attributes->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; @@ -118,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', $showException ? 'exception_full' : $name, 'html', 'twig'); } // to be removed when the minimum required version of Twig is >= 2.0 @@ -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/Loader/FilesystemLoader.php b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php index 816874315a..3c7f925d03 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 and template references. + * to work with the Symfony paths and template references. * * @author Fabien Potencier */ 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..4a17902ae9 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,23 @@ 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'); + $request->attributes->set('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 +72,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)); + } +} 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/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig index 736f718ccf..619469e415 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.type is not empty %}[{{ data.type }}]{% endif %} {% 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 %} 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 @@
- +
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/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index a0d03236de..9812729071 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -249,7 +249,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.'; } @@ -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'); } /** diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 9b3af2464e..17117ffbc7 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -360,6 +360,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 508033f98a..2ce50ee5f9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -305,6 +305,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() 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/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/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 741db1ec23..6965f0a2ba 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 5717ffb154..f6ef3070ca 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php +++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php @@ -20,7 +20,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\ValidatorInterface as LegacyValidatorInterface; /** - * 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/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 1871dde350..0bc7e687e0 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -726,7 +726,19 @@ 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); + if ($this !== $result = $this->query->get($key, $this, $deep)) { + return $result; + } + + if ($this !== $result = $this->attributes->get($key, $this, $deep)) { + return $result; + } + + if ($this !== $result = $this->request->get($key, $this, $deep)) { + return $result; + } + + return $default; } /** 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/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/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/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]; } } 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/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/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 */ 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/Translation/Tests/IdentityTranslatorTest.php b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php index 8d0d280b3b..352dd318dc 100644 --- a/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/IdentityTranslatorTest.php @@ -74,8 +74,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 305a25d42d..2cb5f38ad5 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php @@ -356,18 +356,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( @@ -379,7 +379,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 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(); 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 103fb5a9d3..07a206b67c 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; }