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:previewErrorPageActionhtml\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\TwigExtractorSymfony\Component\HttpKernel\EventListener\ExceptionListenerSymfony\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 %}