Merge branch '2.7' into 2.8

* 2.7: (70 commits)
  [travis] Use container-based infrastructure
  [HttpKernel] use ConfigCache::getPath() method when it exists
  [PropertyAccess] Fix setting public property on a class having a magic getter
  [Routing] Display file which contain deprecated option
  ContainerInterface: unused exception dropped
  bumped Symfony version to 2.6.8
  updated VERSION for 2.6.7
  updated CHANGELOG for 2.6.7
  bumped Symfony version to 2.3.29
  updated VERSION for 2.3.28
  update CONTRIBUTORS for 2.3.28
  updated CHANGELOG for 2.3.28
  [Debug] Fixed ClassNotFoundFatalErrorHandlerTest
  [SecurityBundle] use access decision constants in config
  [SecurityBundle] use session auth constants in config
  PhpDoc fix in AbstractRememberMeServices
  [Filesystem] Simplified an if statement
  [SecurityBundle] Use Enum Nodes Instead Of Scalar
  [Debug 2.3] Fix test for PHP7
  [HttpKernel] Check if "symfony/proxy-manager-bridge" package is installed
  ...

Conflicts:
	src/Symfony/Bundle/DebugBundle/composer.json
	src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
	src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
	src/Symfony/Component/Form/README.md
	src/Symfony/Component/Intl/README.md
	src/Symfony/Component/Security/README.md
	src/Symfony/Component/Translation/Loader/CsvFileLoader.php
	src/Symfony/Component/Translation/Loader/IniFileLoader.php
	src/Symfony/Component/Translation/Loader/MoFileLoader.php
	src/Symfony/Component/Translation/Loader/PhpFileLoader.php
	src/Symfony/Component/Translation/Loader/PoFileLoader.php
	src/Symfony/Component/Translation/Loader/YamlFileLoader.php
	src/Symfony/Component/Translation/README.md
	src/Symfony/Component/Translation/Translator.php
	src/Symfony/Component/Validator/README.md
This commit is contained in:
Nicolas Grekas 2015-05-12 17:16:46 +02:00
commit bb8b0769cb
158 changed files with 1218 additions and 460 deletions

View File

@ -1,5 +1,16 @@
language: php language: php
sudo: false
cache:
directories:
- $HOME/.composer/cache
addons:
apt_packages:
- parallel
- language-pack-fr-base
matrix: matrix:
include: include:
- php: 5.3 - php: 5.3
@ -11,10 +22,10 @@ matrix:
- php: 5.6 - php: 5.6
env: deps=high env: deps=high
- php: nightly - php: nightly
- php: hhvm-nightly - php: hhvm
allow_failures: allow_failures:
- php: nightly - php: nightly
- php: hhvm-nightly - php: hhvm
fast_finish: true fast_finish: true
services: mongodb services: mongodb
@ -25,15 +36,13 @@ env:
- SYMFONY_DEPRECATIONS_HELPER=weak - SYMFONY_DEPRECATIONS_HELPER=weak
before_install: before_install:
- travis_retry sudo apt-get install parallel
- composer self-update - composer self-update
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then phpenv config-rm xdebug.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi;
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini); fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini); fi;
- if [[ "$TRAVIS_PHP_VERSION" != *"nightly" ]]; then php -i; fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;
- sudo locale-gen fr_FR.UTF-8 && sudo update-locale
# Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built # Set the COMPOSER_ROOT_VERSION to the right version according to the branch being built
- if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi; - if [ "$TRAVIS_BRANCH" = "master" ]; then export COMPOSER_ROOT_VERSION=dev-master; else export COMPOSER_ROOT_VERSION="$TRAVIS_BRANCH".x-dev; fi;

View File

@ -7,6 +7,25 @@ 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 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 To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1
* 2.3.28 (2015-05-10)
* bug #14266 [HttpKernel] Check if "symfony/proxy-manager-bridge" package is installed (hason)
* bug #14501 [ProxyBridge] Fix proxy classnames generation (xphere)
* bug #14498 [FrameworkBundle] Added missing log in server:run command (lyrixx)
* bug #14484 [SecurityBundle][WebProfiler] check authenticated user by tokenClass instead of username. (aitboudad)
* bug #14497 [HttpFoundation] Allow curly braces in trusted host patterns (sgrodzicki)
* bug #14436 Show a better error when the port is in use (dosten)
* bug #14463 [Validator] Fixed Choice when an empty array is used in the "choices" option (webmozart)
* bug #14402 [FrameworkBundle][Translation] Check for 'xlf' instead of 'xliff' (xelaris)
* bug #14272 [FrameworkBundle] Workaround php -S ignoring auto_prepend_file (nicolas-grekas)
* bug #14345 [FrameworkBundle] Fix Routing\DelegatingLoader resiliency to fatal errors (nicolas-grekas)
* bug #14325 [Routing][DependencyInjection] Support .yaml extension in YAML loaders (thunderer)
* bug #14344 [Translation][fixed test] refresh cache when resources are no longer fresh. (aitboudad)
* bug #14268 [Translator] Cache does not take fallback locales into consideration (sf2.3) (mpdude)
* bug #14192 [HttpKernel] Embed the original exception as previous to bounced exceptions (nicolas-grekas)
* bug #14102 [Enhancement] netbeans - force interactive shell when limited detection (cordoval)
* bug #14191 [StringUtil] Fixed singularification of 'movies' (GerbenWijnja)
* 2.3.27 (2015-04-01) * 2.3.27 (2015-04-01)
* security #14167 CVE-2015-2308 (nicolas-grekas) * security #14167 CVE-2015-2308 (nicolas-grekas)

View File

@ -7,6 +7,49 @@ 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 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 To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.6.0...v2.6.1
* 2.6.7 (2015-05-11)
* bug #14266 [HttpKernel] Check if "symfony/proxy-manager-bridge" package is installed (hason)
* bug #14478 [DebugBundle] Fix dump() output in API / No-Toolbar context (nicolas-grekas)
* bug #14501 [ProxyBridge] Fix proxy classnames generation (xphere)
* bug #14527 Fix getOrigin (WouterJ)
* bug #14498 [FrameworkBundle] Added missing log in server:run command (lyrixx)
* bug #14503 [Finder] Only use GLOB_BRACE when available (dosten)
* bug #14484 [SecurityBundle][WebProfiler] check authenticated user by tokenClass instead of username. (aitboudad)
* bug #14497 [HttpFoundation] Allow curly braces in trusted host patterns (sgrodzicki)
* bug #14480 [TwigBundle] Fix deprecated use of FlattenException (alOneh)
* bug #14469 [Debug] BaseException compatibility for PHP7 (nicolas-grekas)
* bug #14466 [WebProfiler] fix html syntax for input types (Tobion)
* bug #14436 Show a better error when the port is in use (dosten)
* bug #14463 [Validator] Fixed Choice when an empty array is used in the "choices" option (webmozart)
* bug #14446 [DependencyInjection] resolve circular reference (xabbuh)
* bug #14448 [Validator] Fixed Choice when an empty array is used in the "choices" option (webmozart)
* bug #14451 [Debug] Fix ClassNotFoundFatalErrorHandler candidates lookups (nicolas-grekas)
* bug #14355 [EventDispatcher] make listeners removable from an executed listener (xabbuh)
* bug #14402 [FrameworkBundle][Translation] Check for 'xlf' instead of 'xliff' (xelaris)
* bug #14272 [FrameworkBundle] Workaround php -S ignoring auto_prepend_file (nicolas-grekas)
* bug #14362 [Debug] Scream as LogLevel::DEBUG (but for fatal errors / uncaught exceptions) (nicolas-grekas)
* bug #14345 [FrameworkBundle] Fix Routing\DelegatingLoader resiliency to fatal errors (nicolas-grekas)
* bug #14381 [FrameworkBundle] Initialize translator with the default locale. (aitboudad)
* bug #14325 [Routing][DependencyInjection] Support .yaml extension in YAML loaders (thunderer)
* bug #14344 [Translation][fixed test] refresh cache when resources are no longer fresh. (aitboudad)
* bug #14346 [WebProfilerBundle] Fix resiliency to exceptions thrown by the url generator (nicolas-grekas)
* bug #14338 [FrameworkBundle] improve usage of Table helper (xabbuh)
* bug #14129 [FrameworkBundle] Fixed server:start --router relative path issue #14124 (abulford)
* bug #14271 [VarDumper] Fix call site detection (nicolas-grekas)
* bug #14277 [Translator] Cache does not take fallback locales into consideration (mpdude)
* bug #14268 [Translator] Cache does not take fallback locales into consideration (sf2.3) (mpdude)
* bug #14256 [Form] Fixed DateType/TimeType (webmozart)
* bug #14226 [Profiler][Logger] fixed cycle odd/even. (aitboudad)
* bug #14204 [VarDumper] Towards PHP7 support (nicolas-grekas)
* bug #14205 Fix currently broken tests (mpdude)
* bug #14192 [HttpKernel] Embed the original exception as previous to bounced exceptions (nicolas-grekas)
* bug #14102 [Enhancement] netbeans - force interactive shell when limited detection (cordoval)
* bug #14191 [StringUtil] Fixed singularification of 'movies' (GerbenWijnja)
* bug #14182 [FrameworkBundle] fixes displaying of deprecation notices. (hhamon)
* feature #14186 [Debug] Renamed "context" key to "scope_vars" to avoid any ambiguity (lyrixx)
* bug #14170 Fix the AJAX profiling (stof)
* 2.6.6 (2015-04-01) * 2.6.6 (2015-04-01)
* security #14167 CVE-2015-2308 (nicolas-grekas) * security #14167 CVE-2015-2308 (nicolas-grekas)

View File

@ -9,15 +9,15 @@ Symfony is the result of the work of many people who made the code better
- Victor Berchet (victor) - Victor Berchet (victor)
- Tobias Schultze (tobion) - Tobias Schultze (tobion)
- Jordi Boggiano (seldaek) - Jordi Boggiano (seldaek)
- Nicolas Grekas (nicolas-grekas)
- Johannes S (johannes) - Johannes S (johannes)
- Kris Wallsmith (kriswallsmith) - Kris Wallsmith (kriswallsmith)
- Nicolas Grekas (nicolas-grekas)
- Christophe Coevoet (stof) - Christophe Coevoet (stof)
- Jakub Zalas (jakubzalas) - Jakub Zalas (jakubzalas)
- Pascal Borreli (pborreli) - Pascal Borreli (pborreli)
- Hugo Hamon (hhamon) - Hugo Hamon (hhamon)
- Karma Dordrak (drak)
- Joseph Bielawski (stloyd) - Joseph Bielawski (stloyd)
- Karma Dordrak (drak)
- Ryan Weaver (weaverryan) - Ryan Weaver (weaverryan)
- Lukas Kahwe Smith (lsmith) - Lukas Kahwe Smith (lsmith)
- Romain Neutron (romain) - Romain Neutron (romain)
@ -29,20 +29,20 @@ Symfony is the result of the work of many people who made the code better
- Martin Hasoň (hason) - Martin Hasoň (hason)
- Eriksen Costa (eriksencosta) - Eriksen Costa (eriksencosta)
- Grégoire Pineau (lyrixx) - Grégoire Pineau (lyrixx)
- Jonathan Wage (jwage) - Abdellatif Ait boudad (aitboudad)
- Wouter De Jong (wouterj) - Wouter De Jong (wouterj)
- Jonathan Wage (jwage)
- Alexandre Salomé (alexandresalome) - Alexandre Salomé (alexandresalome)
- William Durand (couac) - William Durand (couac)
- ornicar - ornicar
- stealth35 (stealth35) - stealth35 (stealth35)
- Alexander Mols (asm89) - Alexander Mols (asm89)
- Bulat Shakirzyanov (avalanche123) - Bulat Shakirzyanov (avalanche123)
- Abdellatif Ait boudad (aitboudad)
- Francis Besset (francisbesset) - Francis Besset (francisbesset)
- Kévin Dunglas (dunglas)
- Saša Stamenković (umpirsky) - Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn) - Henrik Bjørnskov (henrikbjorn)
- Miha Vrhovnik - Miha Vrhovnik
- Kévin Dunglas (dunglas)
- Sarah Khalil (saro0h) - Sarah Khalil (saro0h)
- Konstantin Kudryashov (everzet) - Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni) - Bilal Amarni (bamarni)
@ -57,6 +57,7 @@ Symfony is the result of the work of many people who made the code better
- Michel Weimerskirch (mweimerskirch) - Michel Weimerskirch (mweimerskirch)
- Lee McDermott - Lee McDermott
- Brandon Turner - Brandon Turner
- Luis Cordova (cordoval)
- Douglas Greenshields (shieldo) - Douglas Greenshields (shieldo)
- Daniel Holmes (dholmes) - Daniel Holmes (dholmes)
- Bart van den Burg (burgov) - Bart van den Burg (burgov)
@ -64,11 +65,10 @@ Symfony is the result of the work of many people who made the code better
- Kevin Bond (kbond) - Kevin Bond (kbond)
- John Wards (johnwards) - John Wards (johnwards)
- Fran Moreno (franmomu) - Fran Moreno (franmomu)
- Luis Cordova (cordoval)
- Antoine Hérault (herzult) - Antoine Hérault (herzult)
- Toni Uebernickel (havvg) - Toni Uebernickel (havvg)
- Arnaud Le Blanc (arnaud-lb)
- Gábor Egyed (1ed) - Gábor Egyed (1ed)
- Arnaud Le Blanc (arnaud-lb)
- Tim Nagel (merk) - Tim Nagel (merk)
- Brice BERNARD (brikou) - Brice BERNARD (brikou)
- marc.weistroff - marc.weistroff
@ -82,10 +82,13 @@ Symfony is the result of the work of many people who made the code better
- excelwebzone - excelwebzone
- Jacob Dreesen (jdreesen) - Jacob Dreesen (jdreesen)
- Fabien Pennequin (fabienpennequin) - Fabien Pennequin (fabienpennequin)
- Matthias Pigulla (mpdude)
- Peter Kokot (maastermedia) - Peter Kokot (maastermedia)
- Peter Rehm (rpet) - Peter Rehm (rpet)
- Diego Saint Esteben (dii3g0)
- Michal Piotrowski (eventhorizon) - Michal Piotrowski (eventhorizon)
- Stefano Sala (stefano.sala) - Stefano Sala (stefano.sala)
- Javier Eguiluz (javier.eguiluz)
- Gordon Franke (gimler) - Gordon Franke (gimler)
- Robert Schönthal (digitalkaoz) - Robert Schönthal (digitalkaoz)
- Juti Noppornpitak (shiroyuki) - Juti Noppornpitak (shiroyuki)
@ -99,11 +102,10 @@ Symfony is the result of the work of many people who made the code better
- Eric GELOEN (gelo) - Eric GELOEN (gelo)
- Jérémie Augustin (jaugustin) - Jérémie Augustin (jaugustin)
- Rafael Dohms (rdohms) - Rafael Dohms (rdohms)
- Dariusz Ruminski
- Tigran Azatyan (tigranazatyan) - Tigran Azatyan (tigranazatyan)
- Javier Eguiluz (javier.eguiluz)
- Arnaud Kleinpeter (nanocom) - Arnaud Kleinpeter (nanocom)
- Richard Shank (iampersistent) - Richard Shank (iampersistent)
- Dariusz Ruminski
- Clemens Tolboom - Clemens Tolboom
- Helmer Aaviksoo - Helmer Aaviksoo
- Sebastiaan Stok (sstok) - Sebastiaan Stok (sstok)
@ -124,7 +126,7 @@ Symfony is the result of the work of many people who made the code better
- Mario A. Alvarez Garcia (nomack84) - Mario A. Alvarez Garcia (nomack84)
- Dennis Benkert (denderello) - Dennis Benkert (denderello)
- Benjamin Dulau (dbenjamin) - Benjamin Dulau (dbenjamin)
- Matthias Pigulla (mpdude) - Alexander Schwenn (xelaris)
- Andreas Hucks (meandmymonkey) - Andreas Hucks (meandmymonkey)
- Noel Guilbert (noel) - Noel Guilbert (noel)
- Joel Wurtz (brouznouf) - Joel Wurtz (brouznouf)
@ -143,9 +145,10 @@ Symfony is the result of the work of many people who made the code better
- François Zaninotto (fzaninotto) - François Zaninotto (fzaninotto)
- Dustin Whittle (dustinwhittle) - Dustin Whittle (dustinwhittle)
- jeff - jeff
- Joshua Thijssen
- Justin Hileman (bobthecow) - Justin Hileman (bobthecow)
- Sven Paulus (subsven) - Sven Paulus (subsven)
- Alexander Schwenn (xelaris) - Vladimir Reznichenko (kalessil)
- Lars Strojny (lstrojny) - Lars Strojny (lstrojny)
- Rui Marinho (ruimarinho) - Rui Marinho (ruimarinho)
- Mikael Pajunen - Mikael Pajunen
@ -154,6 +157,7 @@ Symfony is the result of the work of many people who made the code better
- Sergey Linnik (linniksa) - Sergey Linnik (linniksa)
- Marcel Beerta (mazen) - Marcel Beerta (mazen)
- Javier Spagnoletti (phansys) - Javier Spagnoletti (phansys)
- julien pauli (jpauli)
- Francois Zaninotto - Francois Zaninotto
- Alexander Kotynia (olden) - Alexander Kotynia (olden)
- Daniel Tschinder - Daniel Tschinder
@ -164,7 +168,6 @@ Symfony is the result of the work of many people who made the code better
- Xavier Montaña Carreras (xmontana) - Xavier Montaña Carreras (xmontana)
- Michele Orselli (orso) - Michele Orselli (orso)
- Chris Wilkinson (thewilkybarkid) - Chris Wilkinson (thewilkybarkid)
- Joshua Thijssen
- Xavier Perez - Xavier Perez
- Arjen Brouwer (arjenjb) - Arjen Brouwer (arjenjb)
- Katsuhiro OGAWA - Katsuhiro OGAWA
@ -184,9 +187,9 @@ Symfony is the result of the work of many people who made the code better
- Nikita Konstantinov - Nikita Konstantinov
- Wodor Wodorski - Wodor Wodorski
- Matthieu Auger (matthieuauger) - Matthieu Auger (matthieuauger)
- julien pauli (jpauli)
- Beau Simensen (simensen) - Beau Simensen (simensen)
- Robert Kiss (kepten) - Robert Kiss (kepten)
- Maxime Steinhausser (ogizanagi)
- John Kary (johnkary) - John Kary (johnkary)
- Ruben Gonzalez (rubenrua) - Ruben Gonzalez (rubenrua)
- Kim Hemsø Rasmussen (kimhemsoe) - Kim Hemsø Rasmussen (kimhemsoe)
@ -194,7 +197,6 @@ Symfony is the result of the work of many people who made the code better
- Tom Van Looy (tvlooy) - Tom Van Looy (tvlooy)
- Wouter Van Hecke - Wouter Van Hecke
- Peter Kruithof (pkruithof) - Peter Kruithof (pkruithof)
- Vladimir Reznichenko (kalessil)
- Michael Holm (hollo) - Michael Holm (hollo)
- Warnar Boekkooi (boekkooi) - Warnar Boekkooi (boekkooi)
- Marc Weistroff (futurecat) - Marc Weistroff (futurecat)
@ -311,14 +313,15 @@ Symfony is the result of the work of many people who made the code better
- Marcin Sikoń (marphi) - Marcin Sikoń (marphi)
- franek (franek) - franek (franek)
- Adam Harvey - Adam Harvey
- Diego Saint Esteben (dii3g0)
- Alex Bakhturin - Alex Bakhturin
- François-Xavier de Guillebon (de-gui_f) - François-Xavier de Guillebon (de-gui_f)
- boombatower - boombatower
- Fabrice Bernhard (fabriceb) - Fabrice Bernhard (fabriceb)
- Jérôme Macias (jeromemacias) - Jérôme Macias (jeromemacias)
- Vincent AUBERT (vincent)
- Fabian Lange (codingfabian) - Fabian Lange (codingfabian)
- Yoshio HANAWA - Yoshio HANAWA
- Tomasz Kowalczyk (thunderer)
- Sebastian Bergmann - Sebastian Bergmann
- Pablo Díez (pablodip) - Pablo Díez (pablodip)
- Kevin McBride - Kevin McBride
@ -329,6 +332,7 @@ Symfony is the result of the work of many people who made the code better
- Iker Ibarguren (ikerib) - Iker Ibarguren (ikerib)
- Ricardo Oliveira (ricardolotr) - Ricardo Oliveira (ricardolotr)
- ondrowan - ondrowan
- Barry vd. Heuvel (barryvdh)
- Jerzy Zawadzki (jzawadzki) - Jerzy Zawadzki (jzawadzki)
- Evan S Kaufman (evanskaufman) - Evan S Kaufman (evanskaufman)
- mcben - mcben
@ -374,7 +378,6 @@ Symfony is the result of the work of many people who made the code better
- Zach Badgett (zachbadgett) - Zach Badgett (zachbadgett)
- Aurélien Fredouelle - Aurélien Fredouelle
- Pavel Campr (pcampr) - Pavel Campr (pcampr)
- Maxime Steinhausser (ogizanagi)
- Disquedur - Disquedur
- Geoffrey Tran (geoff) - Geoffrey Tran (geoff)
- Jan Behrens - Jan Behrens
@ -446,8 +449,6 @@ Symfony is the result of the work of many people who made the code better
- Tiago Brito (blackmx) - Tiago Brito (blackmx)
- Richard van den Brand (ricbra) - Richard van den Brand (ricbra)
- develop - develop
- Vincent AUBERT (vincent)
- Tomasz Kowalczyk (thunderer)
- Mark Sonnabaum - Mark Sonnabaum
- Alexander Obuhovich (aik099) - Alexander Obuhovich (aik099)
- Mathieu Lemoine - Mathieu Lemoine
@ -459,7 +460,6 @@ Symfony is the result of the work of many people who made the code better
- yclian - yclian
- Pascal Helfenstein - Pascal Helfenstein
- Baldur Rensch (brensch) - Baldur Rensch (brensch)
- Barry vd. Heuvel (barryvdh)
- Alex Xandra Albert Sim - Alex Xandra Albert Sim
- Yuen-Chi Lian - Yuen-Chi Lian
- Besnik Br - Besnik Br
@ -602,6 +602,7 @@ Symfony is the result of the work of many people who made the code better
- Zachary Tong (polyfractal) - Zachary Tong (polyfractal)
- Hryhorii Hrebiniuk - Hryhorii Hrebiniuk
- dantleech - dantleech
- Xavier Leune
- Tero Alén (tero) - Tero Alén (tero)
- DerManoMann - DerManoMann
- Guillaume Royer - Guillaume Royer
@ -684,10 +685,12 @@ Symfony is the result of the work of many people who made the code better
- Yannick - Yannick
- Eduardo García Sanz (coma) - Eduardo García Sanz (coma)
- Sebastian Grodzicki (sgrodzicki) - Sebastian Grodzicki (sgrodzicki)
- James Gilliland
- Michael Lee (zerustech) - Michael Lee (zerustech)
- Roy Van Ginneken - Roy Van Ginneken
- David de Boer (ddeboer) - David de Boer (ddeboer)
- Gilles Doge (gido) - Gilles Doge (gido)
- abulford
- Brooks Boyd - Brooks Boyd
- Roger Webb - Roger Webb
- Dmitriy Simushev - Dmitriy Simushev
@ -722,6 +725,7 @@ Symfony is the result of the work of many people who made the code better
- Jeroen van den Enden (stoefke) - Jeroen van den Enden (stoefke)
- origaminal - origaminal
- Quique Porta (quiqueporta) - Quique Porta (quiqueporta)
- Gregor Harlan
- Tomasz Szymczyk (karion) - Tomasz Szymczyk (karion)
- ConneXNL - ConneXNL
- Aharon Perkel - Aharon Perkel
@ -752,6 +756,7 @@ Symfony is the result of the work of many people who made the code better
- Karol Sójko (karolsojko) - Karol Sójko (karolsojko)
- sl_toto (sl_toto) - sl_toto (sl_toto)
- Sébastien HOUZÉ - Sébastien HOUZÉ
- Jingyu Wang
- steveYeah - steveYeah
- Samy Dindane (dinduks) - Samy Dindane (dinduks)
- Keri Henare (kerihenare) - Keri Henare (kerihenare)
@ -881,6 +886,7 @@ Symfony is the result of the work of many people who made the code better
- catch - catch
- Alexandre Segura - Alexandre Segura
- Josef Cech - Josef Cech
- Possum
- Arnau González (arnaugm) - Arnau González (arnaugm)
- Nate (frickenate) - Nate (frickenate)
- Matthew Foster (mfoster) - Matthew Foster (mfoster)
@ -948,6 +954,7 @@ Symfony is the result of the work of many people who made the code better
- Daan van Renterghem - Daan van Renterghem
- Bram Van der Sype (brammm) - Bram Van der Sype (brammm)
- Julien Moulin (lizjulien) - Julien Moulin (lizjulien)
- Romain Gautier (mykiwi)
- Nikita Nefedov (nikita2206) - Nikita Nefedov (nikita2206)
- Mauro Foti (skler) - Mauro Foti (skler)
- Yannick Warnier (ywarnier) - Yannick Warnier (ywarnier)
@ -1015,6 +1022,7 @@ Symfony is the result of the work of many people who made the code better
- Matthieu Prat - Matthieu Prat
- Grummfy - Grummfy
- Filipe Guerra - Filipe Guerra
- Gerben Wijnja
- Rowan Manning - Rowan Manning
- David Windell - David Windell
- Gabriel Birke - Gabriel Birke
@ -1243,6 +1251,7 @@ Symfony is the result of the work of many people who made the code better
- Guillermo Gisinger (t3chn0r) - Guillermo Gisinger (t3chn0r)
- Markus Tacker (tacker) - Markus Tacker (tacker)
- Tyler Stroud (tystr) - Tyler Stroud (tystr)
- Moritz Kraft (userfriendly)
- Víctor Mateo (victormateo) - Víctor Mateo (victormateo)
- Vincent (vincent1870) - Vincent (vincent1870)
- Eugene Babushkin (warl) - Eugene Babushkin (warl)
@ -1266,6 +1275,7 @@ Symfony is the result of the work of many people who made the code better
- Mohamed Karnichi (amiral) - Mohamed Karnichi (amiral)
- Daniel Kolvik (dkvk) - Daniel Kolvik (dkvk)
- Jeroen De Dauw (jeroendedauw) - Jeroen De Dauw (jeroendedauw)
- Maxime COLIN (maximecolin)
- Muharrem Demirci (mdemirci) - Muharrem Demirci (mdemirci)
- Evgeny Z (meze) - Evgeny Z (meze)
- Michiel Boeckaert (milio) - Michiel Boeckaert (milio)

View File

@ -23,34 +23,33 @@ Installation
------------ ------------
The best way to install Symfony 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]. available at <https://symfony.com/download>.
Documentation Documentation
------------- -------------
The "[Quick Tour][2]" tutorial gives you a first feeling of the framework. If, The "[Quick Tour][1]" tutorial gives you a first feeling of the framework. If,
like us, you think that Symfony 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 the quality of your work to the next level, read the official
[Symfony documentation][3]. [Symfony documentation][2].
Contributing Contributing
------------ ------------
Symfony 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 please read the [Contributing Code][3] part of the documentation. If you're submitting
a pull request, please follow the guidelines in the [Submitting a Patch][5] section a pull request, please follow the guidelines in the [Submitting a Patch][4] section
and use [Pull Request Template][6]. and use [Pull Request Template][5].
Running Symfony Tests Running Symfony Tests
---------------------- ----------------------
Information on how to run the Symfony test suite can be found in the Information on how to run the Symfony test suite can be found in the
[Running Symfony Tests][7] section. [Running Symfony Tests][6] section.
[1]: http://symfony.com/download [1]: https://symfony.com/get_started
[2]: http://symfony.com/get_started [2]: https://symfony.com/doc/current/
[3]: http://symfony.com/doc/current/ [3]: https://symfony.com/doc/current/contributing/code/index.html
[4]: http://symfony.com/doc/current/contributing/code/index.html [4]: https://symfony.com/doc/current/contributing/code/patches.html#check-list
[5]: http://symfony.com/doc/current/contributing/code/patches.html#check-list [5]: https://symfony.com/doc/current/contributing/code/patches.html#make-a-pull-request
[6]: http://symfony.com/doc/current/contributing/code/patches.html#make-a-pull-request [6]: https://symfony.com/doc/master/contributing/code/tests.html
[7]: http://symfony.com/doc/master/contributing/code/tests.html

View File

@ -3,7 +3,7 @@
"type": "symfony-bridge", "type": "symfony-bridge",
"description": "Symfony Doctrine Bridge", "description": "Symfony Doctrine Bridge",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "symfony-bridge", "type": "symfony-bridge",
"description": "Symfony Monolog Bridge", "description": "Symfony Monolog Bridge",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "symfony-bridge", "type": "symfony-bridge",
"description": "Symfony PHPUnit Bridge", "description": "Symfony PHPUnit Bridge",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -26,6 +26,11 @@ use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
*/ */
class ProxyDumper implements DumperInterface class ProxyDumper implements DumperInterface
{ {
/**
* @var string
*/
private $salt;
/** /**
* @var LazyLoadingValueHolderGenerator * @var LazyLoadingValueHolderGenerator
*/ */
@ -38,9 +43,12 @@ class ProxyDumper implements DumperInterface
/** /**
* Constructor. * Constructor.
*
* @param string $salt
*/ */
public function __construct() public function __construct($salt = '')
{ {
$this->salt = $salt;
$this->proxyGenerator = new LazyLoadingValueHolderGenerator(); $this->proxyGenerator = new LazyLoadingValueHolderGenerator();
$this->classGenerator = new BaseGeneratorStrategy(); $this->classGenerator = new BaseGeneratorStrategy();
} }
@ -109,6 +117,6 @@ EOF;
*/ */
private function getProxyClassName(Definition $definition) private function getProxyClassName(Definition $definition)
{ {
return str_replace('\\', '', $definition->getClass()).'_'.spl_object_hash($definition); return str_replace('\\', '', $definition->getClass()).'_'.spl_object_hash($definition).$this->salt;
} }
} }

View File

@ -26,9 +26,6 @@ class LazyServiceProjectServiceContainer extends Container
$this->services = $this->services =
$this->scopedServices = $this->scopedServices =
$this->scopeStacks = array(); $this->scopeStacks = array();
$this->set('service_container', $this);
$this->scopes = array(); $this->scopes = array();
$this->scopeChildren = array(); $this->scopeChildren = array();
} }

View File

@ -3,7 +3,7 @@
"type": "symfony-bridge", "type": "symfony-bridge",
"description": "Symfony ProxyManager Bridge", "description": "Symfony ProxyManager Bridge",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "symfony-bridge", "type": "symfony-bridge",
"description": "Symfony Swiftmailer Bridge", "description": "Symfony Swiftmailer Bridge",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -11,10 +11,6 @@
namespace Symfony\Bridge\Twig\Command; namespace Symfony\Bridge\Twig\Command;
if (!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@ -205,7 +201,7 @@ EOF
} }
}); });
$output->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT)); $output->writeln(json_encode($filesInfo, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0));
return min($errors, 1); return min($errors, 1);
} }

View File

@ -3,7 +3,7 @@
"type": "symfony-bridge", "type": "symfony-bridge",
"description": "Symfony Twig Bridge", "description": "Symfony Twig Bridge",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -11,6 +11,7 @@
namespace Symfony\Bundle\DebugBundle\DependencyInjection\Compiler; namespace Symfony\Bundle\DebugBundle\DependencyInjection\Compiler;
use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -35,5 +36,9 @@ class DumpDataCollectorPass implements CompilerPassInterface
if ($container->hasParameter('templating.helper.code.file_link_format')) { if ($container->hasParameter('templating.helper.code.file_link_format')) {
$definition->replaceArgument(1, $container->getParameter('templating.helper.code.file_link_format')); $definition->replaceArgument(1, $container->getParameter('templating.helper.code.file_link_format'));
} }
if (!$container->hasParameter('web_profiler.debug_toolbar.mode') || WebDebugToolbarListener::DISABLED === $container->getParameter('web_profiler.debug_toolbar.mode')) {
$definition->replaceArgument(3, null);
}
} }
} }

View File

@ -15,6 +15,7 @@
<argument type="service" id="debug.stopwatch" on-invalid="ignore" /> <argument type="service" id="debug.stopwatch" on-invalid="ignore" />
<argument>null</argument><!-- %templating.helper.code.file_link_format% --> <argument>null</argument><!-- %templating.helper.code.file_link_format% -->
<argument>%kernel.charset%</argument> <argument>%kernel.charset%</argument>
<argument type="service" id="request_stack" />
</service> </service>
<service id="debug.dump_listener" class="Symfony\Component\HttpKernel\EventListener\DumpListener"> <service id="debug.dump_listener" class="Symfony\Component\HttpKernel\EventListener\DumpListener">

View File

@ -12,8 +12,10 @@
namespace Symfony\Bundle\DebugBundle\Tests\DependencyInjection\Compiler; namespace Symfony\Bundle\DebugBundle\Tests\DependencyInjection\Compiler;
use Symfony\Bundle\DebugBundle\DependencyInjection\Compiler\DumpDataCollectorPass; use Symfony\Bundle\DebugBundle\DependencyInjection\Compiler\DumpDataCollectorPass;
use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpFoundation\RequestStack;
class DumpDataCollectorPassTest extends \PHPUnit_Framework_TestCase class DumpDataCollectorPassTest extends \PHPUnit_Framework_TestCase
{ {
@ -23,7 +25,7 @@ class DumpDataCollectorPassTest extends \PHPUnit_Framework_TestCase
$container->addCompilerPass(new DumpDataCollectorPass()); $container->addCompilerPass(new DumpDataCollectorPass());
$container->setParameter('templating.helper.code.file_link_format', 'file-link-format'); $container->setParameter('templating.helper.code.file_link_format', 'file-link-format');
$definition = new Definition('Symfony\Component\HttpKernel\DataCollector\DumpDataCollector', array(null, null)); $definition = new Definition('Symfony\Component\HttpKernel\DataCollector\DumpDataCollector', array(null, null, null, null));
$container->setDefinition('data_collector.dump', $definition); $container->setDefinition('data_collector.dump', $definition);
$container->compile(); $container->compile();
@ -36,11 +38,53 @@ class DumpDataCollectorPassTest extends \PHPUnit_Framework_TestCase
$container = new ContainerBuilder(); $container = new ContainerBuilder();
$container->addCompilerPass(new DumpDataCollectorPass()); $container->addCompilerPass(new DumpDataCollectorPass());
$definition = new Definition('Symfony\Component\HttpKernel\DataCollector\DumpDataCollector', array(null, null)); $definition = new Definition('Symfony\Component\HttpKernel\DataCollector\DumpDataCollector', array(null, null, null, null));
$container->setDefinition('data_collector.dump', $definition); $container->setDefinition('data_collector.dump', $definition);
$container->compile(); $container->compile();
$this->assertNull($definition->getArgument(1)); $this->assertNull($definition->getArgument(1));
} }
public function testProcessWithToolbarEnabled()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new DumpDataCollectorPass());
$requestStack = new RequestStack();
$definition = new Definition('Symfony\Component\HttpKernel\DataCollector\DumpDataCollector', array(null, null, null, $requestStack));
$container->setDefinition('data_collector.dump', $definition);
$container->setParameter('web_profiler.debug_toolbar.mode', WebDebugToolbarListener::ENABLED);
$container->compile();
$this->assertSame($requestStack, $definition->getArgument(3));
}
public function testProcessWithToolbarDisabled()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new DumpDataCollectorPass());
$definition = new Definition('Symfony\Component\HttpKernel\DataCollector\DumpDataCollector', array(null, null, null, new RequestStack()));
$container->setDefinition('data_collector.dump', $definition);
$container->setParameter('web_profiler.debug_toolbar.mode', WebDebugToolbarListener::DISABLED);
$container->compile();
$this->assertNull($definition->getArgument(3));
}
public function testProcessWithoutToolbar()
{
$container = new ContainerBuilder();
$container->addCompilerPass(new DumpDataCollectorPass());
$definition = new Definition('Symfony\Component\HttpKernel\DataCollector\DumpDataCollector', array(null, null, null, new RequestStack()));
$container->setDefinition('data_collector.dump', $definition);
$container->compile();
$this->assertNull($definition->getArgument(3));
}
} }

View File

@ -3,7 +3,7 @@
"type": "symfony-bundle", "type": "symfony-bundle",
"description": "Symfony DebugBundle", "description": "Symfony DebugBundle",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {
@ -24,7 +24,8 @@
"require-dev": { "require-dev": {
"symfony/phpunit-bridge": "~2.7|~3.0.0", "symfony/phpunit-bridge": "~2.7|~3.0.0",
"symfony/config": "~2.3|~3.0.0", "symfony/config": "~2.3|~3.0.0",
"symfony/dependency-injection": "~2.3|~3.0.0" "symfony/dependency-injection": "~2.3|~3.0.0",
"symfony/web-profiler-bundle": "~2.3|~3.0.0"
}, },
"suggest": { "suggest": {
"symfony/config": "For service container configuration", "symfony/config": "For service container configuration",

View File

@ -41,4 +41,25 @@ abstract class ServerCommand extends ContainerAwareCommand
{ {
return sys_get_temp_dir().'/'.strtr($address, '.:', '--').'.pid'; return sys_get_temp_dir().'/'.strtr($address, '.:', '--').'.pid';
} }
protected function isOtherServerProcessRunning($address)
{
$lockFile = $this->getLockFile($address);
if (file_exists($lockFile)) {
return true;
}
list($hostname, $port) = explode(':', $address);
$fp = @fsockopen($hostname, $port, $errno, $errstr, 5);
if (false !== $fp) {
fclose($fp);
return true;
}
return false;
}
} }

View File

@ -23,7 +23,7 @@ use Symfony\Component\Process\ProcessBuilder;
* *
* @author Michał Pipa <michal.pipa.xsolve@gmail.com> * @author Michał Pipa <michal.pipa.xsolve@gmail.com>
*/ */
class ServerRunCommand extends ContainerAwareCommand class ServerRunCommand extends ServerCommand
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -97,20 +97,26 @@ EOF
} }
$env = $this->getContainer()->getParameter('kernel.environment'); $env = $this->getContainer()->getParameter('kernel.environment');
$address = $input->getArgument('address');
if (false === strpos($address, ':')) {
$address = $address.':'.$input->getOption('port');
}
if ($this->isOtherServerProcessRunning($address)) {
$output->writeln(sprintf('<error>A process is already listening on http://%s.</error>', $address));
return 1;
}
if ('prod' === $env) { if ('prod' === $env) {
$output->writeln('<error>Running PHP built-in server in production environment is NOT recommended!</error>'); $output->writeln('<error>Running PHP built-in server in production environment is NOT recommended!</error>');
} }
$address = $input->getArgument('address');
if (false === strpos($address, ':')) {
$address = $address.':'.$input->getOption('port');
}
$output->writeln(sprintf("Server running on <info>http://%s</info>\n", $address)); $output->writeln(sprintf("Server running on <info>http://%s</info>\n", $address));
$output->writeln('Quit the server with CONTROL-C.'); $output->writeln('Quit the server with CONTROL-C.');
if (null === $builder = $this->createPhpProcessBuilder($input, $output, $env, $address)) { if (null === $builder = $this->createPhpProcessBuilder($output, $address, $input->getOption('router'), $env)) {
return 1; return 1;
} }
@ -137,9 +143,9 @@ EOF
return $process->getExitCode(); return $process->getExitCode();
} }
private function createPhpProcessBuilder(InputInterface $input, OutputInterface $output, $env, $address) private function createPhpProcessBuilder(OutputInterface $output, $address, $router, $env)
{ {
$router = $input->getOption('router') ?: $this $router = $router ?: $this
->getContainer() ->getContainer()
->get('kernel') ->get('kernel')
->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env)) ->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env))

View File

@ -166,27 +166,6 @@ EOF
} }
} }
private function isOtherServerProcessRunning($address)
{
$lockFile = $this->getLockFile($address);
if (file_exists($lockFile)) {
return true;
}
list($hostname, $port) = explode(':', $address);
$fp = @fsockopen($hostname, $port, $errno, $errstr, 5);
if (false !== $fp) {
fclose($fp);
return true;
}
return false;
}
/** /**
* Determine the absolute file path for the router script, using the environment to choose a standard script * Determine the absolute file path for the router script, using the environment to choose a standard script
* if no custom router script is specified. * if no custom router script is specified.

View File

@ -152,7 +152,7 @@ EOF
} }
} }
if ($input->getOption('output-format') == 'xliff') { if ($input->getOption('output-format') == 'xlf') {
$output->writeln('Xliff output version is <info>1.2</info>'); $output->writeln('Xliff output version is <info>1.2</info>');
} }
} }

View File

@ -11,10 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Command; namespace Symfony\Bundle\FrameworkBundle\Command;
if (!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
@ -161,7 +157,7 @@ EOF
} }
}); });
$output->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT)); $output->writeln(json_encode($filesInfo, defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0));
return min($errors, 1); return min($errors, 1);
} }

View File

@ -11,10 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
if (!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}
use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Definition;
@ -174,7 +170,13 @@ class JsonDescriptor extends Descriptor
*/ */
private function writeData(array $data, array $options) private function writeData(array $data, array $options)
{ {
$this->write(json_encode($data, (isset($options['json_encoding']) ? $options['json_encoding'] : 0) | JSON_PRETTY_PRINT)."\n"); $flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
if (defined('JSON_PRETTY_PRINT')) {
$flags |= JSON_PRETTY_PRINT;
}
$this->write(json_encode($data, $flags)."\n");
} }
/** /**

View File

@ -34,3 +34,5 @@ $_SERVER = array_merge($_SERVER, $_ENV);
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_dev.php'; $_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_dev.php';
require 'app_dev.php'; require 'app_dev.php';
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);

View File

@ -34,3 +34,5 @@ $_SERVER = array_merge($_SERVER, $_ENV);
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app.php'; $_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app.php';
require 'app.php'; require 'app.php';
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);

View File

@ -0,0 +1,147 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
use Symfony\Component\Filesystem\Filesystem;
class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
{
private $fs;
private $translationDir;
public function testDebugMissingMessages()
{
$tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo')));
$tester->execute(array('locale' => 'en', 'bundle' => 'foo'));
$this->assertRegExp('/x (\s|\|)+foo/', $tester->getDisplay(), 'Display x in case of missing message');
}
public function testDebugUnusedMessages()
{
$tester = $this->createCommandTester($this->getContainer(array(), array('foo' => 'foo')));
$tester->execute(array('locale' => 'en', 'bundle' => 'foo'));
$this->assertRegExp('/o (\s|\|)+foo/', $tester->getDisplay(), 'Display o in case of unused message');
}
public function testDebugFallbackMessages()
{
$tester = $this->createCommandTester($this->getContainer(array(), array('foo' => 'foo')));
$tester->execute(array('locale' => 'fr', 'bundle' => 'foo'));
$this->assertRegExp('/= (\s|\|)+foo/', $tester->getDisplay(), 'Display = in case of fallback message');
}
public function testNoDefinedMessages()
{
$tester = $this->createCommandTester($this->getContainer());
$tester->execute(array('locale' => 'fr', 'bundle' => 'test'));
$this->assertRegExp('/^No defined or extracted messages for locale "fr"/', $tester->getDisplay());
}
protected function setUp()
{
$this->fs = new Filesystem();
$this->translationDir = sys_get_temp_dir().'/'.uniqid('sf2_translation');
$this->fs->mkdir($this->translationDir.'/Resources/translations');
}
protected function tearDown()
{
$this->fs->remove($this->translationDir);
}
/**
* @return CommandTester
*/
private function createCommandTester($container)
{
$command = new TranslationDebugCommand();
$command->setContainer($container);
$application = new Application();
$application->add($command);
return new CommandTester($application->find('debug:translation'));
}
private function getContainer($extractedMessages = array(), $loadedMessages = array())
{
$translator = $this->getMockBuilder('Symfony\Component\Translation\Translator')
->disableOriginalConstructor()
->getMock();
$translator
->expects($this->any())
->method('getFallbackLocales')
->will($this->returnValue(array('en')));
$extractor = $this->getMock('Symfony\Component\Translation\Extractor\ExtractorInterface');
$extractor
->expects($this->any())
->method('extract')
->will(
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
$catalogue->add($extractedMessages);
})
);
$loader = $this->getMock('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader');
$loader
->expects($this->any())
->method('loadMessages')
->will(
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
$catalogue->add($loadedMessages);
})
);
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
$kernel
->expects($this->any())
->method('getBundle')
->will($this->returnValueMap(array(
array('foo', true, $this->getBundle($this->translationDir)),
array('test', true, $this->getBundle('test')),
)));
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$container
->expects($this->any())
->method('get')
->will($this->returnValueMap(array(
array('translation.extractor', 1, $extractor),
array('translation.loader', 1, $loader),
array('translator', 1, $translator),
array('kernel', 1, $kernel),
)));
return $container;
}
private function getBundle($path)
{
$bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface');
$bundle
->expects($this->any())
->method('getPath')
->will($this->returnValue($path))
;
return $bundle;
}
}

View File

@ -12,7 +12,6 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\Translation; namespace Symfony\Bundle\FrameworkBundle\Tests\Translation;
use Symfony\Bundle\FrameworkBundle\Translation\Translator; use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\MessageSelector;
@ -105,7 +104,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
$translator->trans('foo'); $translator->trans('foo');
} }
public function testLoadRessourcesWithCaching() public function testLoadResourcesWithCaching()
{ {
$loader = new \Symfony\Component\Translation\Loader\YamlFileLoader(); $loader = new \Symfony\Component\Translation\Loader\YamlFileLoader();
$resourceFiles = array( $resourceFiles = array(
@ -133,7 +132,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('folder', $translator->trans('folder')); $this->assertEquals('folder', $translator->trans('folder'));
} }
public function testLoadRessourcesWithoutCaching() public function testLoadResourcesWithoutCaching()
{ {
$loader = new \Symfony\Component\Translation\Loader\YamlFileLoader(); $loader = new \Symfony\Component\Translation\Loader\YamlFileLoader();
$resourceFiles = array( $resourceFiles = array(
@ -271,17 +270,20 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
__DIR__.'/../Fixtures/Resources/translations/messages.fr.yml', __DIR__.'/../Fixtures/Resources/translations/messages.fr.yml',
), ),
); );
$catalogueHash = sha1(serialize(array(
'resources' => array(),
'fallback_locales' => array(),
)));
// prime the cache // prime the cache
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir, 'resource_files' => $resourceFiles), 'yml'); $translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir, 'resource_files' => $resourceFiles), 'yml');
$translator->setLocale('fr');
$this->assertFalse(file_exists($this->tmpDir.'/catalogue.fr.'.$catalogueHash.'.php'));
$translator->warmup($this->tmpDir); $translator->warmup($this->tmpDir);
$this->assertTrue(file_exists($this->tmpDir.'/catalogue.fr.'.$catalogueHash.'.php'));
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
$loader
->expects($this->never())
->method('load');
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir, 'resource_files' => $resourceFiles), 'yml');
$translator->setLocale('fr');
$this->assertEquals('répertoire', $translator->trans('folder'));
} }
private function createTranslator($loader, $options, $translatorClass = '\Symfony\Bundle\FrameworkBundle\Translation\Translator', $loaderFomat = 'loader') private function createTranslator($loader, $options, $translatorClass = '\Symfony\Bundle\FrameworkBundle\Translation\Translator', $loaderFomat = 'loader')

View File

@ -77,6 +77,11 @@ class Translator extends BaseTranslator implements WarmableInterface
*/ */
public function warmUp($cacheDir) public function warmUp($cacheDir)
{ {
// skip warmUp when translator doesn't use cache
if (null === $this->options['cache_dir']) {
return;
}
foreach ($this->resourceLocales as $locale) { foreach ($this->resourceLocales as $locale) {
$this->loadCatalogue($locale); $this->loadCatalogue($locale);
} }

View File

@ -3,7 +3,7 @@
"type": "symfony-bundle", "type": "symfony-bundle",
"description": "Symfony FrameworkBundle", "description": "Symfony FrameworkBundle",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -16,6 +16,7 @@ use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Security\Http\Session\SessionAuthenticationStrategy;
/** /**
* This class contains the configuration information. * This class contains the configuration information.
@ -60,14 +61,20 @@ class MainConfiguration implements ConfigurationInterface
$rootNode $rootNode
->children() ->children()
->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end() ->scalarNode('access_denied_url')->defaultNull()->example('/foo/error403')->end()
->scalarNode('session_fixation_strategy')->cannotBeEmpty()->info('strategy can be: none, migrate, invalidate')->defaultValue('migrate')->end() ->enumNode('session_fixation_strategy')
->values(array(SessionAuthenticationStrategy::NONE, SessionAuthenticationStrategy::MIGRATE, SessionAuthenticationStrategy::INVALIDATE))
->defaultValue(SessionAuthenticationStrategy::MIGRATE)
->end()
->booleanNode('hide_user_not_found')->defaultTrue()->end() ->booleanNode('hide_user_not_found')->defaultTrue()->end()
->booleanNode('always_authenticate_before_granting')->defaultFalse()->end() ->booleanNode('always_authenticate_before_granting')->defaultFalse()->end()
->booleanNode('erase_credentials')->defaultTrue()->end() ->booleanNode('erase_credentials')->defaultTrue()->end()
->arrayNode('access_decision_manager') ->arrayNode('access_decision_manager')
->addDefaultsIfNotSet() ->addDefaultsIfNotSet()
->children() ->children()
->scalarNode('strategy')->defaultValue(AccessDecisionManager::STRATEGY_AFFIRMATIVE)->end() ->enumNode('strategy')
->values(array(AccessDecisionManager::STRATEGY_AFFIRMATIVE, AccessDecisionManager::STRATEGY_CONSENSUS, AccessDecisionManager::STRATEGY_UNANIMOUS))
->defaultValue(AccessDecisionManager::STRATEGY_AFFIRMATIVE)
->end()
->booleanNode('allow_if_all_abstain')->defaultFalse()->end() ->booleanNode('allow_if_all_abstain')->defaultFalse()->end()
->booleanNode('allow_if_equal_granted_denied')->defaultTrue()->end() ->booleanNode('allow_if_equal_granted_denied')->defaultTrue()->end()
->end() ->end()

View File

@ -1,7 +1,7 @@
{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% extends '@WebProfiler/Profiler/layout.html.twig' %}
{% block toolbar %} {% block toolbar %}
{% if collector.user %} {% if collector.tokenClass %}
{% set color_code = (collector.enabled and collector.authenticated) ? 'green' : 'yellow' %} {% set color_code = (collector.enabled and collector.authenticated) ? 'green' : 'yellow' %}
{% set authentication_color_code = (collector.enabled and collector.authenticated) ? 'green' : 'red' %} {% set authentication_color_code = (collector.enabled and collector.authenticated) ? 'green' : 'red' %}
{% set authentication_color_text = (collector.enabled and collector.authenticated) ? 'Yes' : 'No' %} {% set authentication_color_text = (collector.enabled and collector.authenticated) ? 'Yes' : 'No' %}
@ -9,7 +9,7 @@
{% set color_code = collector.enabled ? 'red' : 'black' %} {% set color_code = collector.enabled ? 'red' : 'black' %}
{% endif %} {% endif %}
{% set text %} {% set text %}
{% if collector.user %} {% if collector.tokenClass %}
<div class="sf-toolbar-info-piece"> <div class="sf-toolbar-info-piece">
<b>Logged in as</b> <b>Logged in as</b>
<span class="sf-toolbar-status sf-toolbar-status-{{ color_code }}">{{ collector.user }}</span> <span class="sf-toolbar-status sf-toolbar-status-{{ color_code }}">{{ collector.user }}</span>
@ -47,7 +47,7 @@
{% block panel %} {% block panel %}
<h2>Security</h2> <h2>Security</h2>
{% if collector.user %} {% if collector.tokenClass %}
<table> <table>
<tr> <tr>
<th>Username</th> <th>Username</th>

View File

@ -3,7 +3,7 @@
"type": "symfony-bundle", "type": "symfony-bundle",
"description": "Symfony SecurityBundle", "description": "Symfony SecurityBundle",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -11,7 +11,7 @@
namespace Symfony\Bundle\TwigBundle\Controller; namespace Symfony\Bundle\TwigBundle\Controller;
use Symfony\Component\HttpKernel\Exception\FlattenException; use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -35,7 +35,7 @@ class PreviewErrorController
public function previewErrorPageAction(Request $request, $code) public function previewErrorPageAction(Request $request, $code)
{ {
$exception = FlattenException::create(new \Exception("Something has intentionally gone wrong."), $code); $exception = FlattenException::create(new \Exception('Something has intentionally gone wrong.'), $code);
/* /*
* This Request mimics the parameters set by * This Request mimics the parameters set by

View File

@ -16,7 +16,7 @@
</div> </div>
<div class="search"> <div class="search">
<form method="get" action="http://symfony.com/search" target="_blank"> <form method="get" action="https://symfony.com/search" target="_blank">
<div class="form-row"> <div class="form-row">
<label for="search-id"> <label for="search-id">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAABUElEQVQoz2NgAIJ29iBdD0d7X2cPb+tY2f9MDMjgP2O2hKu7vS8CBlisZUNSMJ3fxRMkXO61wm2ue6I3iB1q8Z8ZriDZFCS03fm/wX+1/xp/TBo8QPxeqf+MUAW+QIFKj/+q/wX/c/3n/i/6Qd/bx943z/Q/K1SBI1D9fKv/AhCn/Wf5L5EHdFGKw39OqAIXoPpOMziX4T9/DFBBnuN/HqhAEtCKCNf/XDA/rZRyAmrpsvrPDVUw3wrkqCiLaewg6TohX1d7X0ffs5r/OaAKfinmgt3t4ulr4+Xg4ANip3j+l/zPArNT4LNOD0pAgWCSOUIBy3+h/+pXbBa5tni0eMx23+/mB1YSYnENroT5Pw/QSOX/mkCo+l/jgo0v2KJA643s8PgAmsMBDCbu/5xALHPB2husxN9uCzsDOgAq5kAoaZVnYMCh5Ky1r88Eh/+iABM8jUk7ClYIAAAAAElFTkSuQmCC" alt="Search on Symfony website" /> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAABUElEQVQoz2NgAIJ29iBdD0d7X2cPb+tY2f9MDMjgP2O2hKu7vS8CBlisZUNSMJ3fxRMkXO61wm2ue6I3iB1q8Z8ZriDZFCS03fm/wX+1/xp/TBo8QPxeqf+MUAW+QIFKj/+q/wX/c/3n/i/6Qd/bx943z/Q/K1SBI1D9fKv/AhCn/Wf5L5EHdFGKw39OqAIXoPpOMziX4T9/DFBBnuN/HqhAEtCKCNf/XDA/rZRyAmrpsvrPDVUw3wrkqCiLaewg6TohX1d7X0ffs5r/OaAKfinmgt3t4ulr4+Xg4ANip3j+l/zPArNT4LNOD0pAgWCSOUIBy3+h/+pXbBa5tni0eMx23+/mB1YSYnENroT5Pw/QSOX/mkCo+l/jgo0v2KJA643s8PgAmsMBDCbu/5xALHPB2husxN9uCzsDOgAq5kAoaZVnYMCh5Ky1r88Eh/+iABM8jUk7ClYIAAAAAElFTkSuQmCC" alt="Search on Symfony website" />

View File

@ -13,7 +13,7 @@ namespace Symfony\Bundle\TwigBundle\Tests\Controller;
use Symfony\Bundle\TwigBundle\Tests\TestCase; use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\Controller\ExceptionController; use Symfony\Bundle\TwigBundle\Controller\ExceptionController;
use Symfony\Component\HttpKernel\Exception\FlattenException; use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class ExceptionControllerTest extends TestCase class ExceptionControllerTest extends TestCase

View File

@ -3,7 +3,7 @@
"type": "symfony-bundle", "type": "symfony-bundle",
"description": "Symfony TwigBundle", "description": "Symfony TwigBundle",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
{% block toolbar %} {% block toolbar %}
{# Symfony Logo #} {# Symfony Logo #}
{% set icon %} {% set icon %}
<a href="http://symfony.com/"> <a href="https://symfony.com/">
<svg width="26" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 26 28" enable-background="new 0 0 26 28" xml:space="preserve"><path fill="#010202" d="M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z"/></svg> <svg width="26" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 26 28" enable-background="new 0 0 26 28" xml:space="preserve"><path fill="#010202" d="M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z"/></svg>
<span> <span>
{% if collector.applicationname %} {% if collector.applicationname %}
@ -35,7 +35,7 @@
Symfony <b>{{ collector.symfonyversion }}</b> Symfony <b>{{ collector.symfonyversion }}</b>
</div> </div>
<div class="sf-toolbar-info-piece"> <div class="sf-toolbar-info-piece">
<a href="http://symfony.com/doc/{{ collector.symfonyversion }}/index.html" rel="help">Symfony Documentation</a> <a href="https://symfony.com/doc/{{ collector.symfonyversion }}/index.html" rel="help">Symfony Documentation</a>
</div> </div>
{% endset %} {% endset %}
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': false } %} {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': false } %}

View File

@ -4,7 +4,7 @@
</h1> </h1>
<div class="search"> <div class="search">
<form method="get" action="http://symfony.com/search" target="_blank"> <form method="get" action="https://symfony.com/search" target="_blank">
<div class="form-row"> <div class="form-row">
<label for="search-id"> <label for="search-id">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAABUElEQVQoz2NgAIJ29iBdD0d7X2cPb+tY2f9MDMjgP2O2hKu7vS8CBlisZUNSMJ3fxRMkXO61wm2ue6I3iB1q8Z8ZriDZFCS03fm/wX+1/xp/TBo8QPxeqf+MUAW+QIFKj/+q/wX/c/3n/i/6Qd/bx943z/Q/K1SBI1D9fKv/AhCn/Wf5L5EHdFGKw39OqAIXoPpOMziX4T9/DFBBnuN/HqhAEtCKCNf/XDA/rZRyAmrpsvrPDVUw3wrkqCiLaewg6TohX1d7X0ffs5r/OaAKfinmgt3t4ulr4+Xg4ANip3j+l/zPArNT4LNOD0pAgWCSOUIBy3+h/+pXbBa5tni0eMx23+/mB1YSYnENroT5Pw/QSOX/mkCo+l/jgo0v2KJA643s8PgAmsMBDCbu/5xALHPB2husxN9uCzsDOgAq5kAoaZVnYMCh5Ky1r88Eh/+iABM8jUk7ClYIAAAAAElFTkSuQmCC" alt="Search on Symfony website"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAABUElEQVQoz2NgAIJ29iBdD0d7X2cPb+tY2f9MDMjgP2O2hKu7vS8CBlisZUNSMJ3fxRMkXO61wm2ue6I3iB1q8Z8ZriDZFCS03fm/wX+1/xp/TBo8QPxeqf+MUAW+QIFKj/+q/wX/c/3n/i/6Qd/bx943z/Q/K1SBI1D9fKv/AhCn/Wf5L5EHdFGKw39OqAIXoPpOMziX4T9/DFBBnuN/HqhAEtCKCNf/XDA/rZRyAmrpsvrPDVUw3wrkqCiLaewg6TohX1d7X0ffs5r/OaAKfinmgt3t4ulr4+Xg4ANip3j+l/zPArNT4LNOD0pAgWCSOUIBy3+h/+pXbBa5tni0eMx23+/mB1YSYnENroT5Pw/QSOX/mkCo+l/jgo0v2KJA643s8PgAmsMBDCbu/5xALHPB2husxN9uCzsDOgAq5kAoaZVnYMCh5Ky1r88Eh/+iABM8jUk7ClYIAAAAAElFTkSuQmCC" alt="Search on Symfony website">

View File

@ -5,26 +5,27 @@
</h3> </h3>
<form action="{{ path('_profiler_search') }}" method="get"> <form action="{{ path('_profiler_search') }}" method="get">
<label for="ip">IP</label> <label for="ip">IP</label>
<input type="text" name="ip" id="ip" value="{{ ip }}" placeholder="e.g. 127.0.0.1"> <input type="text" name="ip" id="ip" value="{{ ip }}">
<div class="clear-fix"></div> <div class="clear-fix"></div>
<label for="method">Method</label> <label for="method">Method</label>
<select name="method" id="method"> <select name="method" id="method">
{% for m in ['', 'DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'] %} <option value=""{{ '' == method ? ' selected="selected"' : '' }}>&nbsp;</option>
{% for m in ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'] %}
<option{{ m == method ? ' selected="selected"' : '' }}>{{ m }}</option> <option{{ m == method ? ' selected="selected"' : '' }}>{{ m }}</option>
{% endfor %} {% endfor %}
</select> </select>
<div class="clear-fix"></div> <div class="clear-fix"></div>
<label for="url">URL</label> <label for="url">URL</label>
<input type="text" name="url" id="url" value="{{ url }}" placeholder="e.g. {{ request.baseUrl }}"> <input type="text" name="url" id="url" value="{{ url }}">
<div class="clear-fix"></div> <div class="clear-fix"></div>
<label for="token">Token</label> <label for="token">Token</label>
<input type="text" name="token" id="token" value="{{ token }}" placeholder="e.g. 1f321b"> <input type="text" name="token" id="token" value="{{ token }}">
<div class="clear-fix"></div> <div class="clear-fix"></div>
<label for="start">From</label> <label for="start">From</label>
<input type="date" name="start" id="start" value="{{ start }}" placeholder="e.g. {{ '-2days'|date('d.m.Y') }}"> <input type="date" name="start" id="start" value="{{ start }}">
<div class="clear-fix"></div> <div class="clear-fix"></div>
<label for="end">Until</label> <label for="end">Until</label>
<input type="date" name="end" id="end" value="{{ end }}" placeholder="e.g. {{ 'now'|date('d.m.Y') }}"> <input type="date" name="end" id="end" value="{{ end }}">
<div class="clear-fix"></div> <div class="clear-fix"></div>
<label for="limit">Limit</label> <label for="limit">Limit</label>
<select name="limit" id="limit"> <select name="limit" id="limit">

View File

@ -3,7 +3,7 @@
"type": "symfony-bundle", "type": "symfony-bundle",
"description": "Symfony WebProfilerBundle", "description": "Symfony WebProfilerBundle",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Asset Component", "description": "Symfony Asset Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony BrowserKit Component", "description": "Symfony BrowserKit Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony ClassLoader Component", "description": "Symfony ClassLoader Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"minimum-stability": "dev", "minimum-stability": "dev",

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Config Component", "description": "Symfony Config Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -62,6 +62,6 @@ component. Find sources and license at https://github.com/Seldaek/hidden-input.
Resources Resources
--------- ---------
[The Console Component](http://symfony.com/doc/current/components/console.html) [The Console Component](https://symfony.com/doc/current/components/console.html)
[How to create a Console Command](http://symfony.com/doc/current/cookbook/console/console_command.html) [How to create a Console Command](https://symfony.com/doc/current/cookbook/console/console_command.html)

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Console Component", "description": "Symfony Console Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony CssSelector Component", "description": "Symfony CssSelector Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -16,7 +16,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -31,6 +31,7 @@ class DebugClassLoader
private $wasFinder; private $wasFinder;
private static $caseCheck; private static $caseCheck;
private static $deprecated = array(); private static $deprecated = array();
private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
/** /**
* Constructor. * Constructor.
@ -68,7 +69,7 @@ class DebugClassLoader
} }
/** /**
* Wraps all autoloaders * Wraps all autoloaders.
*/ */
public static function enable() public static function enable()
{ {
@ -116,7 +117,7 @@ class DebugClassLoader
} }
/** /**
* Finds a file by class name * Finds a file by class name.
* *
* @param string $class A class name to resolve to file * @param string $class A class name to resolve to file
* *
@ -177,7 +178,9 @@ class DebugClassLoader
throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name)); throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
} }
if (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) { if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
} elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]); self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
} else { } else {
if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) { if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) {

View File

@ -14,6 +14,7 @@ namespace Symfony\Component\Debug;
use Psr\Log\LogLevel; use Psr\Log\LogLevel;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\Debug\Exception\ContextErrorException; use Symfony\Component\Debug\Exception\ContextErrorException;
use Symfony\Component\Debug\Exception\FatalBaseException;
use Symfony\Component\Debug\Exception\FatalErrorException; use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\Exception\OutOfMemoryException; use Symfony\Component\Debug\Exception\OutOfMemoryException;
use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
@ -430,22 +431,34 @@ class ErrorHandler
/** /**
* Handles an exception by logging then forwarding it to an other handler. * Handles an exception by logging then forwarding it to an other handler.
* *
* @param \Exception $exception An exception to handle * @param \Exception|\BaseException $exception An exception to handle
* @param array $error An array as returned by error_get_last() * @param array $error An array as returned by error_get_last()
* *
* @internal * @internal
*/ */
public function handleException(\Exception $exception, array $error = null) public function handleException($exception, array $error = null)
{ {
if ($this->loggedErrors & E_ERROR) { if (!$exception instanceof \Exception) {
$exception = new FatalBaseException($exception);
}
$type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
if ($this->loggedErrors & $type) {
$e = array( $e = array(
'type' => E_ERROR, 'type' => $type,
'file' => $exception->getFile(), 'file' => $exception->getFile(),
'line' => $exception->getLine(), 'line' => $exception->getLine(),
'level' => error_reporting(), 'level' => error_reporting(),
'stack' => $exception->getTrace(), 'stack' => $exception->getTrace(),
); );
if ($exception instanceof FatalErrorException) { if ($exception instanceof FatalBaseException) {
$error = array(
'type' => $type,
'message' => $message = $exception->getMessage(),
'file' => $e['file'],
'line' => $e['line'],
);
} elseif ($exception instanceof FatalErrorException) {
$message = 'Fatal '.$exception->getMessage(); $message = 'Fatal '.$exception->getMessage();
} elseif ($exception instanceof \ErrorException) { } elseif ($exception instanceof \ErrorException) {
$message = 'Uncaught '.$exception->getMessage(); $message = 'Uncaught '.$exception->getMessage();
@ -475,6 +488,9 @@ class ErrorHandler
} catch (\Exception $handlerException) { } catch (\Exception $handlerException) {
$this->exceptionHandler = null; $this->exceptionHandler = null;
$this->handleException($handlerException); $this->handleException($handlerException);
} catch (\BaseException $handlerException) {
$this->exceptionHandler = null;
$this->handleException($handlerException);
} }
} }

View File

@ -0,0 +1,44 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Debug\Exception;
/**
* Base Fatal Error Exception.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
class FatalBaseException extends FatalErrorException
{
public function __construct(\BaseException $e)
{
if ($e instanceof \ParseException) {
$message = 'Parse error: '.$e->getMessage();
$severity = E_PARSE;
} elseif ($e instanceof \TypeException) {
$message = 'Type error: '.$e->getMessage();
$severity = E_RECOVERABLE_ERROR;
} else {
$message = 'Fatal error: '.$e->getMessage();
$severity = E_ERROR;
}
\ErrorException::__construct(
$message,
$e->getCode(),
$severity,
$e->getFile(),
$e->getLine()
);
$this->setTrace($e->getTrace());
}
}

View File

@ -104,9 +104,14 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
// if an exception is thrown, the test passed // if an exception is thrown, the test passed
restore_error_handler(); restore_error_handler();
restore_exception_handler(); restore_exception_handler();
$this->assertEquals(E_STRICT, $exception->getSeverity());
$this->assertStringStartsWith(__FILE__, $exception->getFile()); $this->assertStringStartsWith(__FILE__, $exception->getFile());
if (PHP_VERSION_ID < 70000) {
$this->assertRegexp('/^Runtime Notice: Declaration/', $exception->getMessage()); $this->assertRegexp('/^Runtime Notice: Declaration/', $exception->getMessage());
$this->assertEquals(E_STRICT, $exception->getSeverity());
} else {
$this->assertRegexp('/^Warning: Declaration/', $exception->getMessage());
$this->assertEquals(E_WARNING, $exception->getSeverity());
}
} catch (\Exception $exception) { } catch (\Exception $exception) {
restore_error_handler(); restore_error_handler();
restore_exception_handler(); restore_exception_handler();
@ -212,6 +217,32 @@ class DebugClassLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertSame($xError, $lastError); $this->assertSame($xError, $lastError);
} }
public function testReservedForPhp7()
{
if (PHP_VERSION_ID >= 70000) {
$this->markTestSkipped('PHP7 already prevents using reserved names.');
}
set_error_handler('var_dump', 0);
$e = error_reporting(0);
trigger_error('', E_USER_NOTICE);
class_exists('Test\\'.__NAMESPACE__.'\\Float', true);
error_reporting($e);
restore_error_handler();
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
$xError = array(
'type' => E_USER_DEPRECATED,
'message' => 'Test\Symfony\Component\Debug\Tests\Float uses a reserved class name (Float) that will break on PHP 7 and higher',
);
$this->assertSame($xError, $lastError);
}
} }
class ClassLoader class ClassLoader
@ -249,6 +280,8 @@ class ClassLoader
eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedParentClass extends \\'.__NAMESPACE__.'\Fixtures\DeprecatedClass {}'); eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedParentClass extends \\'.__NAMESPACE__.'\Fixtures\DeprecatedClass {}');
} elseif ('Test\\'.__NAMESPACE__.'\DeprecatedInterfaceClass' === $class) { } elseif ('Test\\'.__NAMESPACE__.'\DeprecatedInterfaceClass' === $class) {
eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\DeprecatedInterface {}'); eval('namespace Test\\'.__NAMESPACE__.'; class DeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\DeprecatedInterface {}');
} elseif ('Test\\'.__NAMESPACE__.'\Float' === $class) {
eval('namespace Test\\'.__NAMESPACE__.'; class Float {}');
} }
} }
} }

View File

@ -336,7 +336,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
$logArgCheck = function ($level, $message, $context) use ($that) { $logArgCheck = function ($level, $message, $context) use ($that) {
$that->assertEquals('Fatal Parse Error: foo', $message); $that->assertEquals('Fatal Parse Error: foo', $message);
$that->assertArrayHasKey('type', $context); $that->assertArrayHasKey('type', $context);
$that->assertEquals($context['type'], E_ERROR); $that->assertEquals($context['type'], E_PARSE);
}; };
$logger $logger
@ -345,7 +345,7 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase
->will($this->returnCallback($logArgCheck)) ->will($this->returnCallback($logArgCheck))
; ;
$handler->setDefaultLogger($logger, E_ERROR); $handler->setDefaultLogger($logger, E_PARSE);
$handler->handleFatalError($error); $handler->handleFatalError($error);

View File

@ -181,11 +181,11 @@ class ClassNotFoundFatalErrorHandlerTest extends \PHPUnit_Framework_TestCase
public function testCannotRedeclareClass() public function testCannotRedeclareClass()
{ {
if (!file_exists(__DIR__.'/../FIXTURES/REQUIREDTWICE.PHP')) { if (!file_exists(__DIR__.'/../FIXTURES2/REQUIREDTWICE.PHP')) {
$this->markTestSkipped('Can only be run on case insensitive filesystems'); $this->markTestSkipped('Can only be run on case insensitive filesystems');
} }
require_once __DIR__.'/../FIXTURES/REQUIREDTWICE.PHP'; require_once __DIR__.'/../FIXTURES2/REQUIREDTWICE.PHP';
$error = array( $error = array(
'type' => 1, 'type' => 1,

View File

@ -1,7 +0,0 @@
<?php
namespace Symfony\Component\Debug\Tests\Fixtures;
class RequiredTwice
{
}

View File

@ -0,0 +1,7 @@
<?php
namespace Symfony\Component\Debug\Tests\Fixtures2;
class RequiredTwice
{
}

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -86,8 +86,6 @@ class Container implements IntrospectableContainerInterface
public function __construct(ParameterBagInterface $parameterBag = null) public function __construct(ParameterBagInterface $parameterBag = null)
{ {
$this->parameterBag = $parameterBag ?: new ParameterBag(); $this->parameterBag = $parameterBag ?: new ParameterBag();
$this->set('service_container', $this);
} }
/** /**
@ -261,7 +259,6 @@ class Container implements IntrospectableContainerInterface
* *
* @return object The associated service * @return object The associated service
* *
* @throws InvalidArgumentException if the service is not defined
* @throws ServiceCircularReferenceException When a circular reference is detected * @throws ServiceCircularReferenceException When a circular reference is detected
* @throws ServiceNotFoundException When the service is not defined * @throws ServiceNotFoundException When the service is not defined
* @throws \Exception if an exception has been thrown when the service has been resolved * @throws \Exception if an exception has been thrown when the service has been resolved

View File

@ -470,7 +470,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return $service; return $service;
} }
if (!$this->hasDefinition($id) && isset($this->aliasDefinitions[$id])) { if (!array_key_exists($id, $this->definitions) && isset($this->aliasDefinitions[$id])) {
return $this->get($this->aliasDefinitions[$id]); return $this->get($this->aliasDefinitions[$id]);
} }
@ -684,7 +684,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
throw new InvalidArgumentException('$id must be a string, or an Alias object.'); throw new InvalidArgumentException('$id must be a string, or an Alias object.');
} }
if ($alias === strtolower($id)) { if ($alias === (string) $id) {
throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias)); throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias));
} }
@ -746,7 +746,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
{ {
$id = strtolower($id); $id = strtolower($id);
if (!$this->hasAlias($id)) { if (!isset($this->aliasDefinitions[$id])) {
throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id)); throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id));
} }
@ -864,7 +864,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
{ {
$id = strtolower($id); $id = strtolower($id);
if (!$this->hasDefinition($id)) { if (!array_key_exists($id, $this->definitions)) {
throw new InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id)); throw new InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id));
} }
@ -886,8 +886,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
*/ */
public function findDefinition($id) public function findDefinition($id)
{ {
while ($this->hasAlias($id)) { $id = strtolower($id);
$id = (string) $this->getAlias($id);
while (isset($this->aliasDefinitions[$id])) {
$id = (string) $this->aliasDefinitions[$id];
} }
return $this->getDefinition($id); return $this->getDefinition($id);

View File

@ -50,7 +50,6 @@ interface ContainerInterface
* *
* @return object The associated service * @return object The associated service
* *
* @throws InvalidArgumentException if the service is not defined
* @throws ServiceCircularReferenceException When a circular reference is detected * @throws ServiceCircularReferenceException When a circular reference is detected
* @throws ServiceNotFoundException When the service is not defined * @throws ServiceNotFoundException When the service is not defined
* *

View File

@ -904,9 +904,6 @@ EOF;
\$this->services = \$this->services =
\$this->scopedServices = \$this->scopedServices =
\$this->scopeStacks = array(); \$this->scopeStacks = array();
\$this->set('service_container', \$this);
EOF; EOF;
$code .= "\n"; $code .= "\n";

View File

@ -190,6 +190,13 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($builder->has('bar'), '->setAlias() defines a new service'); $this->assertTrue($builder->has('bar'), '->setAlias() defines a new service');
$this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one'); $this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one');
try {
$builder->setAlias('foobar', 'foobar');
$this->fail('->setAlias() throws an InvalidArgumentException if the alias references itself');
} catch (\InvalidArgumentException $e) {
$this->assertEquals('An alias can not reference itself, got a circular reference on "foobar".', $e->getMessage(), '->setAlias() throws an InvalidArgumentException if the alias references itself');
}
try { try {
$builder->getAlias('foobar'); $builder->getAlias('foobar');
$this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist'); $this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist');

View File

@ -29,9 +29,6 @@ class ProjectServiceContainer extends Container
$this->services = $this->services =
$this->scopedServices = $this->scopedServices =
$this->scopeStacks = array(); $this->scopeStacks = array();
$this->set('service_container', $this);
$this->scopes = array(); $this->scopes = array();
$this->scopeChildren = array(); $this->scopeChildren = array();
$this->methodMap = array( $this->methodMap = array(

View File

@ -33,9 +33,6 @@ class ProjectServiceContainer extends Container
$this->services = $this->services =
$this->scopedServices = $this->scopedServices =
$this->scopeStacks = array(); $this->scopeStacks = array();
$this->set('service_container', $this);
$this->scopes = array(); $this->scopes = array();
$this->scopeChildren = array(); $this->scopeChildren = array();
$this->methodMap = array( $this->methodMap = array(

View File

@ -29,9 +29,6 @@ class ProjectServiceContainer extends Container
$this->services = $this->services =
$this->scopedServices = $this->scopedServices =
$this->scopeStacks = array(); $this->scopeStacks = array();
$this->set('service_container', $this);
$this->scopes = array(); $this->scopes = array();
$this->scopeChildren = array(); $this->scopeChildren = array();
$this->methodMap = array( $this->methodMap = array(

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony DependencyInjection Component", "description": "Symfony DependencyInjection Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony DomCrawler Component", "description": "Symfony DomCrawler Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -77,7 +77,7 @@ interface EventDispatcherInterface
public function removeSubscriber(EventSubscriberInterface $subscriber); public function removeSubscriber(EventSubscriberInterface $subscriber);
/** /**
* Gets the listeners of a specific event or all listeners. * Gets the listeners of a specific event or all listeners sorted by descending priority.
* *
* @param string $eventName The name of the event * @param string $eventName The name of the event
* *

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony EventDispatcher Component", "description": "Symfony EventDispatcher Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony ExpressionLanguage Component", "description": "Symfony ExpressionLanguage Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -439,17 +439,13 @@ class Filesystem
*/ */
public function isAbsolutePath($file) public function isAbsolutePath($file)
{ {
if (strspn($file, '/\\', 0, 1) return (strspn($file, '/\\', 0, 1)
|| (strlen($file) > 3 && ctype_alpha($file[0]) || (strlen($file) > 3 && ctype_alpha($file[0])
&& substr($file, 1, 1) === ':' && substr($file, 1, 1) === ':'
&& (strspn($file, '/\\', 2, 1)) && (strspn($file, '/\\', 2, 1))
) )
|| null !== parse_url($file, PHP_URL_SCHEME) || null !== parse_url($file, PHP_URL_SCHEME)
) { );
return true;
}
return false;
} }
/** /**
@ -480,6 +476,10 @@ class Filesystem
$this->rename($tmpFile, $filename, true); $this->rename($tmpFile, $filename, true);
if (null !== $mode) { if (null !== $mode) {
if (func_num_args() > 2) {
trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
}
$this->chmod($filename, $mode); $this->chmod($filename, $mode);
} }
} }

View File

@ -19,7 +19,7 @@ use Symfony\Component\Filesystem\Filesystem;
class FilesystemTest extends FilesystemTestCase class FilesystemTest extends FilesystemTestCase
{ {
/** /**
* @var \Symfony\Component\Filesystem\Filesystem $filesystem * @var \Symfony\Component\Filesystem\Filesystem
*/ */
private $filesystem = null; private $filesystem = null;
@ -959,6 +959,19 @@ class FilesystemTest extends FilesystemTestCase
{ {
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt'; $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
$this->filesystem->dumpFile($filename, 'bar');
$this->assertFileExists($filename);
$this->assertSame('bar', file_get_contents($filename));
}
/**
* @group legacy
*/
public function testDumpFileAndSetPermissions()
{
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
$this->filesystem->dumpFile($filename, 'bar', 0753); $this->filesystem->dumpFile($filename, 'bar', 0753);
$this->assertFileExists($filename); $this->assertFileExists($filename);

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -671,7 +671,7 @@ class Finder implements \IteratorAggregate, \Countable
foreach ((array) $dirs as $dir) { foreach ((array) $dirs as $dir) {
if (is_dir($dir)) { if (is_dir($dir)) {
$resolvedDirs[] = $dir; $resolvedDirs[] = $dir;
} elseif ($glob = glob($dir, GLOB_BRACE | GLOB_ONLYDIR)) { } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
$resolvedDirs = array_merge($resolvedDirs, $glob); $resolvedDirs = array_merge($resolvedDirs, $glob);
} else { } else {
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));

View File

@ -50,4 +50,4 @@ You can run the unit tests with the following command:
[1]: http://api.symfony.com/2.5/Symfony/Component/Finder/SplFileInfo.html [1]: http://api.symfony.com/2.5/Symfony/Component/Finder/SplFileInfo.html
[2]: http://php.net/splfileinfo [2]: http://php.net/splfileinfo
[3]: http://symfony.com/doc/current/components/finder.html#usage [3]: https://symfony.com/doc/current/components/finder.html#usage

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -46,6 +46,10 @@ class ChoiceToValueTransformer implements DataTransformerInterface
$choices = $this->choiceList->getChoicesForValues(array((string) $value)); $choices = $this->choiceList->getChoicesForValues(array((string) $value));
if (1 !== count($choices)) { if (1 !== count($choices)) {
if (null === $value || '' === $value) {
return;
}
throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value)); throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value));
} }

View File

@ -695,11 +695,11 @@ class Form implements \IteratorAggregate, FormInterface
*/ */
public function addError(FormError $error) public function addError(FormError $error)
{ {
if ($this->parent && $this->config->getErrorBubbling()) {
if (null === $error->getOrigin()) { if (null === $error->getOrigin()) {
$error->setOrigin($this); $error->setOrigin($this);
} }
if ($this->parent && $this->config->getErrorBubbling()) {
$this->parent->addError($error); $this->parent->addError($error);
} else { } else {
$this->errors[] = $error; $this->errors[] = $error;

View File

@ -15,10 +15,10 @@ use Symfony\Component\Form\Deprecated\FormEvents as Deprecated;
/** /**
* To learn more about how form events work check the documentation * To learn more about how form events work check the documentation
* entry at {@link http://symfony.com/doc/any/components/form/form_events.html}. * entry at {@link https://symfony.com/doc/any/components/form/form_events.html}.
* *
* To learn how to dynamically modify forms using events check the cookbook * To learn how to dynamically modify forms using events check the cookbook
* entry at {@link http://symfony.com/doc/any/cookbook/form/dynamic_form_modification.html}. * entry at {@link https://symfony.com/doc/any/cookbook/form/dynamic_form_modification.html}.
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
*/ */

View File

@ -14,7 +14,7 @@ https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/FormServiceProvid
Documentation: Documentation:
http://symfony.com/doc/2.8/book/forms.html https://symfony.com/doc/2.8/book/forms.html
Resources Resources
--------- ---------

View File

@ -329,9 +329,10 @@ abstract class AbstractRequestHandlerTest extends \PHPUnit_Framework_TestCase
$this->requestHandler->handleRequest($form, $this->request); $this->requestHandler->handleRequest($form, $this->request);
if ($shouldFail) { if ($shouldFail) {
$errors = array(new FormError($options['post_max_size_message'], null, $errorParams)); $error = new FormError($options['post_max_size_message'], null, $errorParams);
$error->setOrigin($form);
$this->assertEquals($errors, iterator_to_array($form->getErrors())); $this->assertEquals(array($error), iterator_to_array($form->getErrors()));
$this->assertTrue($form->isSubmitted()); $this->assertTrue($form->isSubmitted());
} else { } else {
$this->assertCount(0, $form->getErrors()); $this->assertCount(0, $form->getErrors());

View File

@ -240,6 +240,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertEquals('b', $form->getData()); $this->assertEquals('b', $form->getData());
$this->assertEquals('b', $form->getViewData()); $this->assertEquals('b', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitSingleNonExpandedInvalidChoice() public function testSubmitSingleNonExpandedInvalidChoice()
@ -269,6 +270,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertNull($form->getData()); $this->assertNull($form->getData());
$this->assertSame('', $form->getViewData()); $this->assertSame('', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
// In edge cases (for example, when choices are loaded dynamically by a // In edge cases (for example, when choices are loaded dynamically by a
@ -286,6 +288,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertNull($form->getData()); $this->assertNull($form->getData());
$this->assertSame('', $form->getViewData()); $this->assertSame('', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitSingleNonExpandedEmpty() public function testSubmitSingleNonExpandedEmpty()
@ -300,6 +303,27 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertNull($form->getData()); $this->assertNull($form->getData());
$this->assertSame('', $form->getViewData()); $this->assertSame('', $form->getViewData());
$this->assertTrue($form->isSynchronized());
}
public function testSubmitSingleNonExpandedEmptyExplicitEmptyChoice()
{
$form = $this->factory->create('choice', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(
'EMPTY_CHOICE' => 'Empty',
),
'choice_value' => function () {
return '';
},
));
$form->submit('');
$this->assertSame('EMPTY_CHOICE', $form->getData());
$this->assertSame('', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
// In edge cases (for example, when choices are loaded dynamically by a // In edge cases (for example, when choices are loaded dynamically by a
@ -317,6 +341,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertNull($form->getData()); $this->assertNull($form->getData());
$this->assertSame('', $form->getViewData()); $this->assertSame('', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitSingleNonExpandedFalse() public function testSubmitSingleNonExpandedFalse()
@ -331,6 +356,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertNull($form->getData()); $this->assertNull($form->getData());
$this->assertSame('', $form->getViewData()); $this->assertSame('', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
// In edge cases (for example, when choices are loaded dynamically by a // In edge cases (for example, when choices are loaded dynamically by a
@ -348,6 +374,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertNull($form->getData()); $this->assertNull($form->getData());
$this->assertSame('', $form->getViewData()); $this->assertSame('', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitSingleNonExpandedObjectChoices() public function testSubmitSingleNonExpandedObjectChoices()
@ -366,6 +393,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertEquals($this->objectChoices[1], $form->getData()); $this->assertEquals($this->objectChoices[1], $form->getData());
$this->assertEquals('2', $form->getViewData()); $this->assertEquals('2', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
/** /**
@ -392,6 +420,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertEquals($this->objectChoices[1], $form->getData()); $this->assertEquals($this->objectChoices[1], $form->getData());
$this->assertEquals('2', $form->getViewData()); $this->assertEquals('2', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitMultipleNonExpanded() public function testSubmitMultipleNonExpanded()
@ -406,6 +435,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertEquals(array('a', 'b'), $form->getData()); $this->assertEquals(array('a', 'b'), $form->getData());
$this->assertEquals(array('a', 'b'), $form->getViewData()); $this->assertEquals(array('a', 'b'), $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitMultipleNonExpandedEmpty() public function testSubmitMultipleNonExpandedEmpty()
@ -420,6 +450,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertSame(array(), $form->getData()); $this->assertSame(array(), $form->getData());
$this->assertSame(array(), $form->getViewData()); $this->assertSame(array(), $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
// In edge cases (for example, when choices are loaded dynamically by a // In edge cases (for example, when choices are loaded dynamically by a
@ -437,6 +468,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertSame(array(), $form->getData()); $this->assertSame(array(), $form->getData());
$this->assertSame(array(), $form->getViewData()); $this->assertSame(array(), $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitMultipleNonExpandedInvalidScalarChoice() public function testSubmitMultipleNonExpandedInvalidScalarChoice()
@ -484,6 +516,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertEquals(array($this->objectChoices[1], $this->objectChoices[2]), $form->getData()); $this->assertEquals(array($this->objectChoices[1], $this->objectChoices[2]), $form->getData());
$this->assertEquals(array('2', '3'), $form->getViewData()); $this->assertEquals(array('2', '3'), $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
/** /**
@ -509,6 +542,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertEquals(array($this->objectChoices[1], $this->objectChoices[2]), $form->getData()); $this->assertEquals(array($this->objectChoices[1], $this->objectChoices[2]), $form->getData());
$this->assertEquals(array('2', '3'), $form->getViewData()); $this->assertEquals(array('2', '3'), $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitSingleExpandedRequired() public function testSubmitSingleExpandedRequired()
@ -933,6 +967,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit(''); $form->submit('');
$this->assertNull($form->getData()); $this->assertNull($form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertTrue($form[0]->getData()); $this->assertTrue($form[0]->getData());
$this->assertFalse($form[1]->getData()); $this->assertFalse($form[1]->getData());
$this->assertSame('', $form[0]->getViewData()); $this->assertSame('', $form[0]->getViewData());
@ -953,6 +989,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit('2'); $form->submit('2');
$this->assertSame($this->objectChoices[1], $form->getData()); $this->assertSame($this->objectChoices[1], $form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertFalse($form[0]->getData()); $this->assertFalse($form[0]->getData());
$this->assertTrue($form[1]->getData()); $this->assertTrue($form[1]->getData());
$this->assertFalse($form[2]->getData()); $this->assertFalse($form[2]->getData());
@ -987,6 +1025,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit('2'); $form->submit('2');
$this->assertSame($this->objectChoices[1], $form->getData()); $this->assertSame($this->objectChoices[1], $form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertFalse($form[0]->getData()); $this->assertFalse($form[0]->getData());
$this->assertTrue($form[1]->getData()); $this->assertTrue($form[1]->getData());
$this->assertFalse($form[2]->getData()); $this->assertFalse($form[2]->getData());
@ -1010,6 +1050,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit('1'); $form->submit('1');
$this->assertSame(1, $form->getData()); $this->assertSame(1, $form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertFalse($form[0]->getData()); $this->assertFalse($form[0]->getData());
$this->assertTrue($form[1]->getData()); $this->assertTrue($form[1]->getData());
$this->assertFalse($form[2]->getData()); $this->assertFalse($form[2]->getData());
@ -1114,6 +1156,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit(array()); $form->submit(array());
$this->assertSame(array(), $form->getData()); $this->assertSame(array(), $form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertFalse($form[0]->getData()); $this->assertFalse($form[0]->getData());
$this->assertFalse($form[1]->getData()); $this->assertFalse($form[1]->getData());
$this->assertFalse($form[2]->getData()); $this->assertFalse($form[2]->getData());
@ -1140,6 +1184,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit(array()); $form->submit(array());
$this->assertSame(array(), $form->getData()); $this->assertSame(array(), $form->getData());
$this->assertTrue($form->isSynchronized());
} }
public function testSubmitMultipleExpandedWithEmptyChild() public function testSubmitMultipleExpandedWithEmptyChild()
@ -1157,6 +1202,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit(array('', '2')); $form->submit(array('', '2'));
$this->assertSame(array('', 2), $form->getData()); $this->assertSame(array('', 2), $form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertTrue($form[0]->getData()); $this->assertTrue($form[0]->getData());
$this->assertFalse($form[1]->getData()); $this->assertFalse($form[1]->getData());
$this->assertTrue($form[2]->getData()); $this->assertTrue($form[2]->getData());
@ -1179,6 +1226,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit(array('1', '2')); $form->submit(array('1', '2'));
$this->assertSame(array($this->objectChoices[0], $this->objectChoices[1]), $form->getData()); $this->assertSame(array($this->objectChoices[0], $this->objectChoices[1]), $form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertTrue($form[0]->getData()); $this->assertTrue($form[0]->getData());
$this->assertTrue($form[1]->getData()); $this->assertTrue($form[1]->getData());
$this->assertFalse($form[2]->getData()); $this->assertFalse($form[2]->getData());
@ -1213,6 +1262,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit(array('1', '2')); $form->submit(array('1', '2'));
$this->assertSame(array($this->objectChoices[0], $this->objectChoices[1]), $form->getData()); $this->assertSame(array($this->objectChoices[0], $this->objectChoices[1]), $form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertTrue($form[0]->getData()); $this->assertTrue($form[0]->getData());
$this->assertTrue($form[1]->getData()); $this->assertTrue($form[1]->getData());
$this->assertFalse($form[2]->getData()); $this->assertFalse($form[2]->getData());
@ -1236,6 +1287,8 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$form->submit(array('1', '2')); $form->submit(array('1', '2'));
$this->assertSame(array(1, 2), $form->getData()); $this->assertSame(array(1, 2), $form->getData());
$this->assertTrue($form->isSynchronized());
$this->assertFalse($form[0]->getData()); $this->assertFalse($form[0]->getData());
$this->assertTrue($form[1]->getData()); $this->assertTrue($form[1]->getData());
$this->assertTrue($form[2]->getData()); $this->assertTrue($form[2]->getData());
@ -1264,6 +1317,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertFalse($form->getData()); $this->assertFalse($form->getData());
$this->assertEquals('0', $form->getViewData()); $this->assertEquals('0', $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testSetDataMultipleNonExpandedAcceptsBoolean() public function testSetDataMultipleNonExpandedAcceptsBoolean()
@ -1278,6 +1332,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertEquals(array(false, true), $form->getData()); $this->assertEquals(array(false, true), $form->getData());
$this->assertEquals(array('0', '1'), $form->getViewData()); $this->assertEquals(array('0', '1'), $form->getViewData());
$this->assertTrue($form->isSynchronized());
} }
public function testPassRequiredToView() public function testPassRequiredToView()
@ -1344,7 +1399,7 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
$this->assertNull($view->vars['choice_translation_domain']); $this->assertNull($view->vars['choice_translation_domain']);
} }
public function testDefaulChoiceTranslationDomainIsSameAsTranslationDomainToView() public function testDefaultChoiceTranslationDomainIsSameAsTranslationDomainToView()
{ {
$form = $this->factory->create('choice', null, array( $form = $this->factory->create('choice', null, array(
'choices' => $this->choices, 'choices' => $this->choices,

View File

@ -393,8 +393,10 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
)); ));
$errors = $form->getErrors(); $errors = $form->getErrors();
$expected = new FormError('[trans]Foobar[/trans]');
$expected->setOrigin($form);
$this->assertGreaterThan(0, count($errors)); $this->assertGreaterThan(0, count($errors));
$this->assertEquals(new FormError('[trans]Foobar[/trans]'), $errors[0]); $this->assertEquals($expected, $errors[0]);
} }
} }

View File

@ -319,7 +319,7 @@ class FormDataExtractorTest extends \PHPUnit_Framework_TestCase
'norm' => "'Foobar'", 'norm' => "'Foobar'",
), ),
'errors' => array( 'errors' => array(
array('message' => 'Invalid!', 'origin' => null, 'trace' => array()), array('message' => 'Invalid!', 'origin' => spl_object_hash($form), 'trace' => array()),
), ),
'synchronized' => 'true', 'synchronized' => 'true',
), $this->dataExtractor->extractSubmittedData($form)); ), $this->dataExtractor->extractSubmittedData($form));
@ -360,7 +360,7 @@ class FormDataExtractorTest extends \PHPUnit_Framework_TestCase
'norm' => "'Foobar'", 'norm' => "'Foobar'",
), ),
'errors' => array( 'errors' => array(
array('message' => 'Invalid!', 'origin' => null, 'trace' => array( array('message' => 'Invalid!', 'origin' => spl_object_hash($form), 'trace' => array(
array( array(
'class' => "'Exception'", 'class' => "'Exception'",
'message' => "''", 'message' => "''",

View File

@ -15,6 +15,7 @@ use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper;
use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Form; use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\FormConfigBuilder;
use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormError;
use Symfony\Component\PropertyAccess\PropertyPath; use Symfony\Component\PropertyAccess\PropertyPath;
@ -110,9 +111,12 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
/** /**
* @return FormError * @return FormError
*/ */
protected function getFormError(ConstraintViolationInterface $violation) protected function getFormError(ConstraintViolationInterface $violation, FormInterface $form)
{ {
return new FormError($this->message, $this->messageTemplate, $this->params, null, $violation); $error = new FormError($this->message, $this->messageTemplate, $this->params, null, $violation);
$error->setOrigin($form);
return $error;
} }
public function testMapToFormInheritingParentDataIfDataDoesNotMatch() public function testMapToFormInheritingParentDataIfDataDoesNotMatch()
@ -130,7 +134,7 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
$this->mapper->mapViolation($violation, $parent); $this->mapper->mapViolation($violation, $parent);
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($child->getErrors()), $child->getName().' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $child)), iterator_to_array($child->getErrors()), $child->getName().' should have an error, but has none');
$this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one');
} }
@ -159,7 +163,7 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertCount(0, $child->getErrors(), $child->getName().' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $child->getName().' should not have an error, but has one');
$this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($grandGrandChild->getErrors()), $grandGrandChild->getName().' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $grandGrandChild)), iterator_to_array($grandGrandChild->getErrors()), $grandGrandChild->getName().' should have an error, but has none');
} }
public function testAbortMappingIfNotSynchronized() public function testAbortMappingIfNotSynchronized()
@ -800,17 +804,17 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
$this->mapper->mapViolation($violation, $parent); $this->mapper->mapViolation($violation, $parent);
if (self::LEVEL_0 === $target) { if (self::LEVEL_0 === $target) {
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($parent->getErrors()), $parent->getName().' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $parent)), iterator_to_array($parent->getErrors()), $parent->getName().' should have an error, but has none');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
} elseif (self::LEVEL_1 === $target) { } elseif (self::LEVEL_1 === $target) {
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($child->getErrors()), $childName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $child)), iterator_to_array($child->getErrors()), $childName.' should have an error, but has none');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
} else { } else {
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($grandChild->getErrors()), $grandChildName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $grandChild)), iterator_to_array($grandChild->getErrors()), $grandChildName.' should have an error, but has none');
} }
} }
@ -1274,17 +1278,17 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
} }
if (self::LEVEL_0 === $target) { if (self::LEVEL_0 === $target) {
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($parent->getErrors()), $parent->getName().' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $parent)), iterator_to_array($parent->getErrors()), $parent->getName().' should have an error, but has none');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
} elseif (self::LEVEL_1 === $target) { } elseif (self::LEVEL_1 === $target) {
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($child->getErrors()), $childName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $child)), iterator_to_array($child->getErrors()), $childName.' should have an error, but has none');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
} else { } else {
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($grandChild->getErrors()), $grandChildName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $grandChild)), iterator_to_array($grandChild->getErrors()), $grandChildName.' should have an error, but has none');
} }
} }
@ -1458,16 +1462,16 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
if (self::LEVEL_0 === $target) { if (self::LEVEL_0 === $target) {
$this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one'); $this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($parent->getErrors()), $parent->getName().' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $parent)), iterator_to_array($parent->getErrors()), $parent->getName().' should have an error, but has none');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
} elseif (self::LEVEL_1 === $target) { } elseif (self::LEVEL_1 === $target) {
$this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one'); $this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one');
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($child->getErrors()), $childName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $child)), iterator_to_array($child->getErrors()), $childName.' should have an error, but has none');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
} elseif (self::LEVEL_1B === $target) { } elseif (self::LEVEL_1B === $target) {
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($errorChild->getErrors()), $errorName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $errorChild)), iterator_to_array($errorChild->getErrors()), $errorName.' should have an error, but has none');
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
@ -1475,7 +1479,7 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
$this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one'); $this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one');
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($grandChild->getErrors()), $grandChildName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $grandChild)), iterator_to_array($grandChild->getErrors()), $grandChildName.' should have an error, but has none');
} }
} }
@ -1522,17 +1526,17 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
$this->mapper->mapViolation($violation, $parent); $this->mapper->mapViolation($violation, $parent);
if (self::LEVEL_0 === $target) { if (self::LEVEL_0 === $target) {
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($parent->getErrors()), $parent->getName().' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $parent)), iterator_to_array($parent->getErrors()), $parent->getName().' should have an error, but has none');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
} elseif (self::LEVEL_1 === $target) { } elseif (self::LEVEL_1 === $target) {
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($child->getErrors()), $childName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $child)), iterator_to_array($child->getErrors()), $childName.' should have an error, but has none');
$this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one'); $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
} else { } else {
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one'); $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation)), iterator_to_array($grandChild->getErrors()), $grandChildName.' should have an error, but has none'); $this->assertEquals(array($this->getFormError($violation, $grandChild)), iterator_to_array($grandChild->getErrors()), $grandChildName.' should have an error, but has none');
} }
} }
} }

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Form Component", "description": "Symfony Form Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -594,7 +594,7 @@ class Request
public static function setTrustedHosts(array $hostPatterns) public static function setTrustedHosts(array $hostPatterns)
{ {
self::$trustedHostPatterns = array_map(function ($hostPattern) { self::$trustedHostPatterns = array_map(function ($hostPattern) {
return sprintf('{%s}i', str_replace('}', '\\}', $hostPattern)); return sprintf('#%s#i', $hostPattern);
}, $hostPatterns); }, $hostPatterns);
// we need to reset trusted hosts on trusted host patterns change // we need to reset trusted hosts on trusted host patterns change
self::$trustedHosts = array(); self::$trustedHosts = array();

View File

@ -1708,7 +1708,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('evil.com', $request->getHost()); $this->assertEquals('evil.com', $request->getHost());
// add a trusted domain and all its subdomains // add a trusted domain and all its subdomains
Request::setTrustedHosts(array('.*\.?trusted.com$')); Request::setTrustedHosts(array('^([a-z]{9}\.)?trusted\.com$'));
// untrusted host // untrusted host
$request->headers->set('host', 'evil.com'); $request->headers->set('host', 'evil.com');

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony HttpFoundation Component", "description": "Symfony HttpFoundation Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -83,7 +83,7 @@ class ConfigDataCollector extends DataCollector
$this->data['bundles'][$name] = $bundle->getPath(); $this->data['bundles'][$name] = $bundle->getPath();
} }
$this->data['symfony_state'] = $this->requestSymfonyState(); $this->data['symfony_state'] = $this->determineSymfonyState();
} }
} }
@ -268,63 +268,23 @@ class ConfigDataCollector extends DataCollector
/** /**
* Tries to retrieve information about the current Symfony version. * Tries to retrieve information about the current Symfony version.
* *
* @return string One of: unknown, dev, stable, eom, eol * @return string One of: dev, stable, eom, eol
*/ */
private function requestSymfonyState() private function determineSymfonyState()
{ {
$versionInfo = null;
// get version information from cache or the roadmap
$versionCachePath = $this->kernel->getCacheDir().'/version_info.json';
if (file_exists($versionCachePath)) {
$versionInfo = json_decode(file_get_contents($versionCachePath), true);
} else {
$versionResponse = @file_get_contents('http://symfony.com/roadmap.json?version='.preg_replace('/^(\d+\.\d+).*/', '\\1', $this->data['symfony_version']));
if (false !== $versionResponse) {
$versionInfo = json_decode($versionResponse, true);
if (isset($versionInfo['error_message'])) {
// wrong version
$versionInfo = null;
}
}
}
// get the version state
$versionState = 'unknown';
if (null !== $versionInfo) {
$now = new \DateTime(); $now = new \DateTime();
$eom = \DateTime::createFromFormat('m/Y', $versionInfo['eom'])->modify('last day of this month'); $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE)->modify('last day of this month');
$eol = \DateTime::createFromFormat('m/Y', $versionInfo['eol'])->modify('last day of this month'); $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE)->modify('last day of this month');
if ($now > $eom) { if ($now > $eol) {
$versionState = 'eom';
} elseif ($now > $eol) {
$versionState = 'eol'; $versionState = 'eol';
} elseif ('DEV' === Kernel::EXTRA_VERSION) { } elseif ($now > $eom) {
$versionState = 'eom';
} elseif ('' !== Kernel::EXTRA_VERSION) {
$versionState = 'dev'; $versionState = 'dev';
} else { } else {
$versionState = 'stable'; $versionState = 'stable';
} }
}
// invalidate or create cache
if (null === $versionInfo) {
// nothing to cache
} elseif (isset($versionInfo['previous_state'])) {
if ($versionInfo['previous_state'] !== $versionState) {
// state changed => invalidate the cache
unlink($versionCachePath);
}
} elseif (substr(Kernel::VERSION, 0, 3) !== $versionInfo['version']) {
// version changed => invalidate the cache
unlink($versionCachePath);
} elseif ($this->cacheVersionInfo) {
// no cache yet
$versionInfo['previous_state'] = $versionState;
file_put_contents($versionCachePath, json_encode($versionInfo));
}
return $versionState; return $versionState;
} }

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\HttpKernel\DataCollector; namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\VarDumper\Cloner\Data;
@ -33,12 +34,14 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
private $clonesIndex = 0; private $clonesIndex = 0;
private $rootRefs; private $rootRefs;
private $charset; private $charset;
private $dumper;
public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null, $charset = null) public function __construct(Stopwatch $stopwatch = null, $fileLinkFormat = null, $charset = null, RequestStack $requestStack = null)
{ {
$this->stopwatch = $stopwatch; $this->stopwatch = $stopwatch;
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
$this->charset = $charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'; $this->charset = $charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8';
$this->requestStack = $requestStack;
// All clones share these properties by reference: // All clones share these properties by reference:
$this->rootRefs = array( $this->rootRefs = array(
@ -118,8 +121,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$name = substr($name, strrpos($name, '/') + 1); $name = substr($name, strrpos($name, '/') + 1);
} }
if ($this->dumper) {
$this->doDump($data, $name, $file, $line);
} else {
$this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt'); $this->data[] = compact('data', 'name', 'file', 'line', 'fileExcerpt');
++$this->dataCount; ++$this->dataCount;
}
if ($this->stopwatch) { if ($this->stopwatch) {
$this->stopwatch->stop('dump'); $this->stopwatch->stop('dump');
@ -128,6 +135,33 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
public function collect(Request $request, Response $response, \Exception $exception = null) public function collect(Request $request, Response $response, \Exception $exception = null)
{ {
if ($this->requestStack && $this->requestStack->getMasterRequest() !== $request) {
return;
}
// In all conditions that remove the web debug toolbar, dumps are written on the output.
if (!$this->requestStack
|| $request->isXmlHttpRequest()
|| !$response->headers->has('X-Debug-Token')
|| $response->isRedirection()
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
|| 'html' !== $request->getRequestFormat()
|| false === strripos($response->getContent(), '</body>')
) {
if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) {
$this->dumper = new HtmlDumper('php://output', $this->charset);
} else {
$this->dumper = new CliDumper('php://output', $this->charset);
}
foreach ($this->data as $i => $dump) {
$this->data[$i] = null;
$this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']);
}
$this->data = array();
$this->dataCount = 0;
}
} }
public function serialize() public function serialize()
@ -140,6 +174,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
$this->data = array(); $this->data = array();
$this->dataCount = 0; $this->dataCount = 0;
$this->isCollected = true; $this->isCollected = true;
$this->dumper = null;
return $ser; return $ser;
} }
@ -203,31 +238,14 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
} }
if ('cli' !== PHP_SAPI && stripos($h[$i], 'html')) { if ('cli' !== PHP_SAPI && stripos($h[$i], 'html')) {
$dumper = new HtmlDumper('php://output', $this->charset); $this->dumper = new HtmlDumper('php://output', $this->charset);
} else { } else {
$dumper = new CliDumper('php://output', $this->charset); $this->dumper = new CliDumper('php://output', $this->charset);
$dumper->setColors(false);
} }
foreach ($this->data as $i => $dump) { foreach ($this->data as $i => $dump) {
$this->data[$i] = null; $this->data[$i] = null;
$this->doDump($dump['data'], $dump['name'], $dump['file'], $dump['line']);
if ($dumper instanceof HtmlDumper) {
$dump['name'] = $this->htmlEncode($dump['name']);
$dump['file'] = $this->htmlEncode($dump['file']);
if ('' !== $dump['file']) {
if ($this->fileLinkFormat) {
$link = strtr($this->fileLinkFormat, array('%f' => $dump['file'], '%l' => $dump['line']));
$dump['name'] = sprintf('<a href="%s" title="%s">%s</a>', $link, $dump['file'], $dump['name']);
} else {
$dump['name'] = sprintf('<abbr title="%s">%s</abbr>', $dump['file'], $dump['name']);
}
}
echo "\n<span class=\"sf-dump-meta\">{$dump['name']} on line {$dump['line']}:</span>";
} else {
echo "{$dump['name']} on line {$dump['line']}:\n";
}
$dumper->dump($dump['data']);
} }
$this->data = array(); $this->data = array();
@ -235,6 +253,26 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
} }
} }
private function doDump($data, $name, $file, $line)
{
if ($this->dumper instanceof HtmlDumper) {
$name = $this->htmlEncode($name);
$file = $this->htmlEncode($file);
if ('' !== $file) {
if ($this->fileLinkFormat) {
$link = strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line));
$name = sprintf('<a href="%s" title="%s">%s</a>', $link, $file, $name);
} else {
$name = sprintf('<abbr title="%s">%s</abbr>', $file, $name);
}
}
echo "\n<span class=\"sf-dump-meta\">{$name} on line {$line}:</span>";
} else {
echo "{$name} on line {$line}:\n";
}
$this->dumper->dump($data);
}
private function htmlEncode($s) private function htmlEncode($s)
{ {
$html = ''; $html = '';

View File

@ -67,6 +67,9 @@ abstract class Kernel implements KernelInterface, TerminableInterface
const RELEASE_VERSION = '0'; const RELEASE_VERSION = '0';
const EXTRA_VERSION = 'DEV'; const EXTRA_VERSION = 'DEV';
const END_OF_MAINTENANCE = '05/2018';
const END_OF_LIFE = '05/2019';
/** /**
* Constructor. * Constructor.
* *
@ -671,7 +674,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
{ {
$container = new ContainerBuilder(new ParameterBag($this->getKernelParameters())); $container = new ContainerBuilder(new ParameterBag($this->getKernelParameters()));
if (class_exists('ProxyManager\Configuration')) { if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator')) {
$container->setProxyInstantiator(new RuntimeInstantiator()); $container->setProxyInstantiator(new RuntimeInstantiator());
} }
@ -691,8 +694,8 @@ abstract class Kernel implements KernelInterface, TerminableInterface
// cache the container // cache the container
$dumper = new PhpDumper($container); $dumper = new PhpDumper($container);
if (class_exists('ProxyManager\Configuration')) { if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) {
$dumper->setProxyDumper(new ProxyDumper()); $dumper->setProxyDumper(new ProxyDumper(md5($cache->getPath())));
} }
$content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath())); $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath()));

View File

@ -12,11 +12,11 @@
namespace Symfony\Component\HttpKernel\Tests\DataCollector; namespace Symfony\Component\HttpKernel\Tests\DataCollector;
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector; use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\VarDumper\Cloner\Data;
/** /**
* DumpDataCollectorTest
*
* @author Nicolas Grekas <p@tchwork.com> * @author Nicolas Grekas <p@tchwork.com>
*/ */
class DumpDataCollectorTest extends \PHPUnit_Framework_TestCase class DumpDataCollectorTest extends \PHPUnit_Framework_TestCase
@ -58,6 +58,49 @@ class DumpDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertSame('a:0:{}', $collector->serialize()); $this->assertSame('a:0:{}', $collector->serialize());
} }
public function testCollectDefault()
{
$data = new Data(array(array(123)));
$collector = new DumpDataCollector();
$collector->dump($data);
$line = __LINE__ - 1;
ob_start();
$collector->collect(new Request(), new Response());
$output = ob_get_clean();
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output);
}
public function testCollectHtml()
{
$data = new Data(array(array(123)));
$collector = new DumpDataCollector(null, 'test://%f:%l');
$collector->dump($data);
$line = __LINE__ - 1;
$file = __FILE__;
$xOutput = <<<EOTXT
<span class="sf-dump-meta"><a href="test://{$file}:{$line}" title="{$file}">DumpDataCollectorTest.php</a> on line {$line}:</span> <pre class=sf-dump id=sf-dump data-indent-pad=" "><span class=sf-dump-num>123</span>
</pre>
EOTXT;
ob_start();
$response = new Response();
$response->headers->set('Content-Type', 'text/html');
$collector->collect(new Request(), $response);
$output = ob_get_clean();
$output = preg_replace('#<(script|style).*?</\1>#s', '', $output);
$output = preg_replace('/sf-dump-\d+/', 'sf-dump', $output);
$this->assertSame($xOutput, $output);
}
public function testFlush() public function testFlush()
{ {
$data = new Data(array(array(456))); $data = new Data(array(array(456)));

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony HttpKernel Component", "description": "Symfony HttpKernel Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -22,4 +22,4 @@ You can run the unit tests with the following command:
$ phpunit $ phpunit
[0]: http://www.php.net/manual/en/intl.setup.php [0]: http://www.php.net/manual/en/intl.setup.php
[1]: http://symfony.com/doc/2.8/components/intl.html [1]: https://symfony.com/doc/2.8/components/intl.html

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "A PHP replacement layer for the C intl extension that includes additional data from the ICU library.", "description": "A PHP replacement layer for the C intl extension that includes additional data from the ICU library.",
"keywords": ["intl", "icu", "internationalization", "localization", "i18n", "l10n"], "keywords": ["intl", "icu", "internationalization", "localization", "i18n", "l10n"],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -20,7 +20,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Locale Component", "description": "Symfony Locale Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony OptionsResolver Component", "description": "Symfony OptionsResolver Component",
"keywords": ["options", "config", "configuration"], "keywords": ["options", "config", "configuration"],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -3,7 +3,7 @@
"type": "library", "type": "library",
"description": "Symfony Process Component", "description": "Symfony Process Component",
"keywords": [], "keywords": [],
"homepage": "http://symfony.com", "homepage": "https://symfony.com",
"license": "MIT", "license": "MIT",
"authors": [ "authors": [
{ {
@ -12,7 +12,7 @@
}, },
{ {
"name": "Symfony Community", "name": "Symfony Community",
"homepage": "http://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"require": { "require": {

View File

@ -314,11 +314,11 @@ class PropertyAccessor implements PropertyAccessorInterface
$result[self::VALUE] = $object->$isser(); $result[self::VALUE] = $object->$isser();
} elseif ($reflClass->hasMethod($hasser) && $reflClass->getMethod($hasser)->isPublic()) { } elseif ($reflClass->hasMethod($hasser) && $reflClass->getMethod($hasser)->isPublic()) {
$result[self::VALUE] = $object->$hasser(); $result[self::VALUE] = $object->$hasser();
} elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) {
$result[self::VALUE] = $object->$property;
} elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) { } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
$result[self::VALUE] = &$object->$property; $result[self::VALUE] = &$object->$property;
$result[self::IS_REF] = true; $result[self::IS_REF] = true;
} elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) {
$result[self::VALUE] = $object->$property;
} elseif (!$classHasProperty && property_exists($object, $property)) { } elseif (!$classHasProperty && property_exists($object, $property)) {
// Needed to support \stdClass instances. We need to explicitly // Needed to support \stdClass instances. We need to explicitly
// exclude $classHasProperty, otherwise if in the previous clause // exclude $classHasProperty, otherwise if in the previous clause
@ -410,10 +410,10 @@ class PropertyAccessor implements PropertyAccessorInterface
$object->$setter($value); $object->$setter($value);
} elseif ($this->isMethodAccessible($reflClass, $getsetter, 1)) { } elseif ($this->isMethodAccessible($reflClass, $getsetter, 1)) {
$object->$getsetter($value); $object->$getsetter($value);
} elseif ($this->isMethodAccessible($reflClass, '__set', 2)) {
$object->$property = $value;
} elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) { } elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
$object->$property = $value; $object->$property = $value;
} elseif ($this->isMethodAccessible($reflClass, '__set', 2)) {
$object->$property = $value;
} elseif (!$classHasProperty && property_exists($object, $property)) { } elseif (!$classHasProperty && property_exists($object, $property)) {
// Needed to support \stdClass instances. We need to explicitly // Needed to support \stdClass instances. We need to explicitly
// exclude $classHasProperty, otherwise if in the previous clause // exclude $classHasProperty, otherwise if in the previous clause

Some files were not shown because too many files have changed in this diff Show More