diff --git a/.composer-auth.json b/.composer-auth.json new file mode 100644 index 0000000000000..bf40540cc644c --- /dev/null +++ b/.composer-auth.json @@ -0,0 +1,7 @@ +{ + "github-oauth": { + "github.com": "PLEASE DO NOT USE THIS TOKEN IN YOUR OWN PROJECTS/FORKS", + "github.com": "This token is reserved for testing the symfony/symfony repository", + "github.com": "52270bad1071a099c8d24629f2db2b7f07db960d" + } +} diff --git a/.php_cs b/.php_cs index 11d42d1287e47..290e9bf5fbcba 100644 --- a/.php_cs +++ b/.php_cs @@ -24,5 +24,7 @@ return Symfony\CS\Config\Config::create() ->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml') // test template ->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') + // explicit heredoc test + ->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php') ) ; diff --git a/.travis.yml b/.travis.yml index ac722f4db2cd4..6da2fb04da51c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,17 +30,19 @@ services: mongodb before_install: - if [[ ! $deps && ! $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && $TRAVIS_PHP_VERSION != hhvm && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; fi; - - if [[ ! $deps && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi; + - if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi; - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi; - echo memory_limit = -1 >> $INI_FILE - echo session.gc_probability = 0 >> $INI_FILE - if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi; - if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi; - - if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE) || echo "Let's continue without apcu extension"; fi; - - if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi; + - if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi; + - if [[ $TRAVIS_PHP_VERSION = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi; - if [[ $TRAVIS_PHP_VERSION = 5.* && ! $deps ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi; + - if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0; fi; - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi; - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi; + - if [[ $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer-auth.json ~/.composer/auth.json; fi; - if [[ $deps != skip ]]; then composer self-update; fi; - if [[ $deps != skip ]]; then ./phpunit install; fi; - export PHPUNIT=$(readlink -f ./phpunit) @@ -49,16 +51,16 @@ install: - if [[ $deps != skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi; - if [[ $deps != skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi; - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi; - - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; fi; + - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi; - if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi; - export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev; - - if [[ ! $deps ]]; then composer --prefer-source install; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi; + - if [[ ! $deps ]]; then composer update --prefer-dist; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi; - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi; script: - if [[ ! $deps ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi; - if [[ ! $deps ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi; - - if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | parallel --gnu 'echo -e "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi; - - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source update; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi; - - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi; + - if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi; + - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --prefer-dist; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi; + - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --prefer-dist --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi; - if [[ $deps = skip ]]; then echo This matrix line is skipped for pull requests.; fi; diff --git a/CHANGELOG-3.0.md b/CHANGELOG-3.0.md index da9b973fda50d..4f119cb3603da 100644 --- a/CHANGELOG-3.0.md +++ b/CHANGELOG-3.0.md @@ -7,6 +7,103 @@ in 3.0 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.0.0...v3.0.1 +* 3.0.2 (2016-02-03) + + * bug #17658 [FrameworkBundle] fix assets and templating tests (xabbuh) + * bug #17596 [Translation] Add resources from fallback locale to parent catalogue (c960657) + * bug #17605 [FrameworkBundle] remove default null value for asset version (xabbuh) + * bug #17606 [DependencyInjection] pass triggerDeprecationError arg to parent class (xabbuh) + * bug #16956 [DependencyInjection] XmlFileLoader: enforce tags to have a name (xabbuh) + * bug #16265 [BrowserKit] Corrected HTTP_HOST logic (Naktibalda) + * bug #17559 [SecurityBundle] Fix HTTP Digest auth not being passed user checker (SamFleming) + * bug #17554 [DependencyInjection] resolve aliases in factories (xabbuh) + * bug #17555 [DependencyInjection] resolve aliases in factory services (xabbuh) + * bug #17511 [Form] ArrayChoiceList can now deal with a null in choices (issei-m) + * bug #17430 [Serializer] Ensure that groups are strings (dunglas) + * bug #16795 [FrameworkBundle][Validator] Fix apc cache service & config (ogizanagi) + * bug #15272 [FrameworkBundle] Fix template location for PHP templates (jakzal) + * bug #11232 [Routing] Fixes fatal errors with object resources in AnnotationDirectoryLoader::supports (Tischoi) + * bug #17526 Escape the delimiter in Glob::toRegex (javiereguiluz) + * bug #17527 fixed undefined variable (fabpot) + * bug #15706 [framework-bundle] Added support for the `0.0.0.0/0` trusted proxy (zerkms) + * bug #16274 [HttpKernel] Lookup the response even if the lock was released after two second wait (jakzal) + * bug #16954 [TranslationUpdateCommand] fixed undefined resultMessage var. (aitboudad) + * bug #17355 [DoctrineBridge][Validator] >= 2.3 Pass association instead of ID as argument (xavismeh) + * bug #17330 Limit the max height/width of icons in the profiler menu (javiereguiluz) + * bug #17454 Allow absolute URLs to be displayed in the debug toolbar (javiereguiluz) + * bug #16736 [Request] Ignore invalid IP addresses sent by proxies (GromNaN) + * bug #17459 [EventDispatcher] TraceableEventDispatcher resets event listener priorities (c960657) + * bug #17486 [FrameworkBundle] Throw for missing container extensions (kix) + * bug #16961 Overriding profiler position in CSS breaks JS positioning (aschempp) + * bug #16873 Able to load big xml files with DomCrawler (zorn-v) + * bug #16897 [Form] Fix constraints could be null if not set (DZunke) + * bug #16912 [Translation][Writer] avoid calling setBackup if the dumper is not FileDumper (aitboudad) + * bug #17505 sort bundles in config:dump-reference command (xabbuh) + * bug #17506 [FrameworkBundle] enable assets when templates are enabled (xabbuh) + * bug #17514 [Asset] Add defaultNull to version configuration (ewgRa) + * bug #16511 [Asset] Ability to set empty version strategy in packages (ewgRa) + * bug #17457 Display Ajax requests from newest to oldest in the toolbar (javiereguiluz) + * bug #17503 [Asset] CLI: use request context to generate absolute URLs (xabbuh) + * bug #17478 [HttpFoundation] Do not overwrite the Authorization header if it is already set (jakzal) + * bug #17461 [Yaml] tag for dumped PHP objects must be a local one (xabbuh) + * bug #16822 [FrameworkBundle][Validator] Fix apc cache service deprecation (ogizanagi) + * bug #17463 [Form] make tests compatible with Symfony 2.8 and 3.0 (xabbuh) + * bug #17456 [DX] Remove default match from AbstractConfigCommand::findExtension (kix) + * bug #17455 Fixed form types in profiler (javiereguiluz) + * bug #17424 [Process] Update in 2.7 for stream-based output storage (romainneutron) + * bug #17417 Fixed the form profiler when using long form types (javiereguiluz) + * bug #17423 [Process] Use stream based storage to avoid memory issues (romainneutron) + * bug #17041 [FrameworkBundle] Added the assets helper again (dosten) + * bug #17406 [Form] ChoiceType: Fix a notice when 'choices' normalizer is replaced (paradajozsef) + * bug #17433 [FrameworkBundle] Don't log twice with the error handler (nicolas-grekas) + * bug #17418 Fixed Bootstrap form theme form "reset" buttons (javiereguiluz) + * bug #17416 [PropertyInfo] PhpDocExtractor: Fix a notice when the property doesn'… (dunglas) + * bug #17404 fix merge 2.3 into 2.7 for SecureRandom dependency (Tobion) + * bug #17373 [SecurityBundle] fix SecureRandom service constructor args (Tobion) + * bug #17397 Remove remaining calls to non-existing method (paradajozsef) + * bug #17382 [TwigBridge] Use label_format option for checkbox and radio labels (enumag) + * bug #17380 [TwigBridge] Use label_format option for checkbox and radio labels (enumag) + * bug #17377 Fix performance (PHP5) and memory (PHP7) issues when using token_get_all (nicolas-grekas, peteward) + * bug #17389 [Routing] Fixed correct class name in thrown exception (fixes #17388) (robinvdvleuten) + * bug #17358 [ClassLoader] Use symfony/polyfill-apcu (nicolas-grekas) + * bug #17370 [HttpFoundation][Cookie] Cookie DateTimeInterface fix (wildewouter) + * security #17359 do not ship with a custom rng implementation (xabbuh, fabpot) + * bug #17253 [Console] HHVM read input stream bug (mbutkereit) + * bug #17314 Fix max width for multibyte keys in choice question (mheki) + * bug #17326 [Console] Display console application name even when no version set (polc) + * bug #17328 [Serializer] Allow to use proxies in object_to_populate (dunglas) + * bug #17202 [FrameworkBundle] Don't log twice with the error handler (nicolas-grekas) + * bug #17347 Workaround https://bugs.php.net/63206 (nicolas-grekas) + * bug #17340 [HttpFoundation] Fixed Request HTTP_USER_AGENT on 3.X versions (davelima) + * bug #17199 [Serializer] Allow context to contain not serializable data (dunglas, nicolas-grekas) + * bug #17334 [WebProfiler] Fixed sf-minitoolbar height (yceruto) + * bug #17140 [Serializer] Remove normalizer cache in Serializer class (jvasseur) + * bug #17320 [Debug] Fixed erroneous deprecation notice for extended Interfaces (peterrehm) + * bug #17307 [FrameworkBundle] Fix paths with % in it (like urlencoded) (scaytrase) + * bug #17078 [Bridge] [Doctrine] [Validator] Added support \IteratorAggregate for UniqueEntityValidator (Disparity) + * bug #17298 [FrameworkBundle] Use proper class to fetch $versionStrategy property (dosten) + * bug #17287 [HttpKernel] Forcing string comparison on query parameters sort in UriSigner (Tim van Densen) + * bug #17279 [FrameworkBundle] Add case in Kernel directory guess for PHPUnit (tgalopin) + * bug #17278 [FrameworkBundle] Add case in Kernel directory guess for PHPUnit (tgalopin) + * bug #17063 bug #14246 [Filesystem] dumpFile() negates default file permissions (Hidde Boomsma) + * bug #17283 [WebProfilerBundle] Remove loading status from AJAX toolbar after error (kucharovic) + * bug #17275 [PhpUnitBridge] Re-enable the garbage collector (nicolas-grekas) + * bug #17276 [Process] Fix potential race condition (nicolas-grekas) + * bug #17261 [FrameworkBundle] Allow to autowire service_container (dunglas) + * bug #17183 [FrameworkBundle] Set the kernel.name properly after a cache warmup (jakzal) + * bug #17197 [Yaml] cast arrays to objects after parsing has finished (xabbuh) + * bug #17247 Fix toolbar display when nvd3 is loaded on page (Seldaek) + * bug #17159 [Yaml] recognize when a block scalar is left (xabbuh) + * bug #17195 bug #14246 [Filesystem] dumpFile() non atomic (Hidde Boomsma) + * feature #16747 [Form] Improved performance of ChoiceType and its subtypes (webmozart) + * bug #17179 [WebProfiler] Removed an object as route generator argument (iltar) + * bug #17177 [Process] Fix potential race condition leading to transient tests (nicolas-grekas) + * bug #17163 [Form] fix Catchable Fatal Error if choices is not an array (Gladhon, nicolas-grekas) + * bug #17152 [DoctrineBridge] [PropertyInfo] Catch Doctrine\ORM\Mapping\MappingException (dunglas) + * bug #17119 [Form] improve deprecation message for "empty_value" and "choice_list" options. (hhamon) + * bug #17156 [HttpFoundation] add missing symfony/polyfill-php55 dependency (xabbuh) + * bug #17162 [Form] Fix regression on Collection type (hason) + * 3.0.1 (2015-12-26) * bug #16864 [Yaml] fix indented line handling in folded blocks (xabbuh) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9b30d35c1a0ae..5786f19dde7d6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -13,8 +13,8 @@ Symfony is the result of the work of many people who made the code better - Christophe Coevoet (stof) - Johannes S (johannes) - Kris Wallsmith (kriswallsmith) - - Jakub Zalas (jakubzalas) - Christian Flothmann (xabbuh) + - Jakub Zalas (jakubzalas) - Ryan Weaver (weaverryan) - Pascal Borreli (pborreli) - Hugo Hamon (hhamon) @@ -30,8 +30,8 @@ Symfony is the result of the work of many people who made the code better - Martin Hasoň (hason) - Wouter De Jong (wouterj) - Eriksen Costa (eriksencosta) - - Grégoire Pineau (lyrixx) - Javier Eguiluz (javier.eguiluz) + - Grégoire Pineau (lyrixx) - Kévin Dunglas (dunglas) - Jonathan Wage (jwage) - Alexandre Salomé (alexandresalome) @@ -49,17 +49,17 @@ Symfony is the result of the work of many people who made the code better - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) - Florin Patan (florinpatan) + - Maxime Steinhausser (ogizanagi) - Eric Clemmons (ericclemmons) - Andrej Hudec (pulzarraider) - - Maxime Steinhausser (ogizanagi) - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - Gábor Egyed (1ed) - Christian Raue + - Michel Weimerskirch (mweimerskirch) - Arnout Boks (aboks) - Kevin Bond (kbond) - - Michel Weimerskirch (mweimerskirch) - Douglas Greenshields (shieldo) - Lee McDermott - Brandon Turner @@ -67,57 +67,60 @@ Symfony is the result of the work of many people who made the code better - Daniel Holmes (dholmes) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) + - Matthias Pigulla (mpdude) - John Wards (johnwards) - Fran Moreno (franmomu) - Antoine Hérault (herzult) - Toni Uebernickel (havvg) - - Matthias Pigulla (mpdude) - Arnaud Le Blanc (arnaud-lb) - Tim Nagel (merk) - Brice BERNARD (brikou) + - Graham Campbell (graham) - Jérôme Tamarelle (gromnan) - marc.weistroff + - Michal Piotrowski (eventhorizon) - lenar - - Graham Campbell (graham) - Włodzimierz Gajda (gajdaw) - Florian Voutzinos (florianv) + - Peter Rehm (rpet) - Colin Frei + - Dariusz Ruminski - Adrien Brault (adrienbrault) - excelwebzone - Jacob Dreesen (jdreesen) - - Michal Piotrowski (eventhorizon) - Peter Kokot (maastermedia) - Fabien Pennequin (fabienpennequin) - - Peter Rehm (rpet) - Pierre du Plessis (pierredup) - Alexander Schwenn (xelaris) - Gordon Franke (gimler) + - Iltar van der Berg (kjarli) - Robert Schönthal (digitalkaoz) - Jérémy DERUSSÉ (jderusse) - - Dariusz Ruminski - Joshua Thijssen - Stefano Sala (stefano.sala) - David Buchmann (dbu) - Issei Murasawa (issei_m) - - Iltar van der Berg (kjarli) - Juti Noppornpitak (shiroyuki) - Eric GELOEN (gelo) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) + - Vladimir Reznichenko (kalessil) - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) - - Vladimir Reznichenko (kalessil) + - Tigran Azatyan (tigranazatyan) - Jérémie Augustin (jaugustin) - Sebastiaan Stok (sstok) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) - - Tigran Azatyan (tigranazatyan) + - Alexander M. Turek (derrabus) - Richard Shank (iampersistent) + - Charles Sarrazin (csarrazi) - Clemens Tolboom - Helmer Aaviksoo - Baptiste Clavié (talus) - Tugdual Saunier (tucksaun) + - Andréia Bohner (andreia) - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) @@ -125,9 +128,7 @@ Symfony is the result of the work of many people who made the code better - Jonathan Ingram (jonathaningram) - Artur Kotyrba - Rouven Weßling (realityking) - - Charles Sarrazin (csarrazi) - Warnar Boekkooi (boekkooi) - - Andréia Bohner (andreia) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) - Dorian Villet (gnutix) @@ -135,19 +136,20 @@ Symfony is the result of the work of many people who made the code better - Richard Miller (mr_r_miller) - hacfi (hifi) - Mario A. Alvarez Garcia (nomack84) + - Thomas Rabaix (rande) - Dennis Benkert (denderello) - - Alexander M. Turek (derrabus) - Konstantin Myakshin (koc) - Benjamin Dulau (dbenjamin) - Andreas Hucks (meandmymonkey) - Mikael Pajunen - Noel Guilbert (noel) - Joel Wurtz (brouznouf) + - Evgeniy (ewgraf) - bronze1man - sun (sun) - Larry Garfield (crell) - Martin Schuhfuß (usefulthink) - - Thomas Rabaix (rande) + - Jáchym Toušek - Matthieu Bontemps (mbontemps) - Pierre Minnieur (pminnieur) - fivestar @@ -163,10 +165,8 @@ Symfony is the result of the work of many people who made the code better - Lars Strojny (lstrojny) - Daniel Wehner - Rui Marinho (ruimarinho) - - Evgeniy (ewgraf) - Julien Brochet (mewt) - Sergey Linnik (linniksa) - - Jáchym Toušek - Marcel Beerta (mazen) - Vincent AUBERT (vincent) - julien pauli (jpauli) @@ -177,6 +177,7 @@ Symfony is the result of the work of many people who made the code better - Elnur Abdurrakhimov (elnur) - Manuel Reinhard (sprain) - Danny Berger (dpb587) + - Diego Saint Esteben (dosten) - Roman Marintšenko (inori) - Xavier Montaña Carreras (xmontana) - Chris Wilkinson (thewilkybarkid) @@ -207,7 +208,6 @@ Symfony is the result of the work of many people who made the code better - Ruben Gonzalez (rubenrua) - Marcos Sánchez - Kim Hemsø Rasmussen (kimhemsoe) - - Diego Saint Esteben (dosten) - Tom Van Looy (tvlooy) - Wouter Van Hecke - Peter Kruithof (pkruithof) @@ -237,6 +237,7 @@ Symfony is the result of the work of many people who made the code better - Jan Decavele (jandc) - Gustavo Piltcher - Stepan Tanasiychuk (stfalcon) + - Titouan Galopin (tgalopin) - Tiago Ribeiro (fixe) - Bob den Otter (bopp) - Adrian Rudnik (kreischweide) @@ -244,6 +245,7 @@ Symfony is the result of the work of many people who made the code better - Julien Galenski (ruian) - Bongiraud Dominique - janschoenherr + - Jannik Zschiesche (apfelbox) - Thomas Schulz (king2500) - Marco Pivetta (ocramius) - Ricard Clau (ricardclau) @@ -252,6 +254,7 @@ Symfony is the result of the work of many people who made the code better - Erin Millard - Matthew Lewinski (lewinski) - Antonio J. García Lagar (ajgarlag) + - Roumen Damianoff (roumen) - alquerci - Francesco Levorato - Vitaliy Zakharov (zakharovvi) @@ -273,7 +276,9 @@ Symfony is the result of the work of many people who made the code better - Stéphane PY (steph_py) - Philipp Kräutli (pkraeutli) - Kirill chEbba Chebunin (chebba) + - Filippo Tessarotto - Greg Thornton (xdissent) + - jeremyFreeAgent (jeremyfreeagent) - Costin Bereveanu (schniper) - Loïc Chardonnet (gnusat) - Marek Kalnik (marekkalnik) @@ -306,7 +311,6 @@ Symfony is the result of the work of many people who made the code better - Christophe L. (christophelau) - Massimiliano Arione (garak) - Anthon Pang (robocoder) - - Jannik Zschiesche (apfelbox) - Emanuele Gaspari (inmarelibero) - Dariusz Rumiński - Brian King @@ -318,12 +322,14 @@ Symfony is the result of the work of many people who made the code better - Jan Schumann - Niklas Fiekas - Mark Challoner (markchalloner) + - Gregor Harlan (gharlan) - Markus Bachmann (baachi) - lancergr - Olivier Dolbeau (odolbeau) - - Roumen Damianoff (roumen) + - Ben Davies (bendavies) - vagrant - Asier Illarramendi (doup) + - Artur Melo (restless) - Chris Sedlmayr (catchamonkey) - Seb Koelen - Christoph Mewes (xrstf) @@ -333,6 +339,7 @@ Symfony is the result of the work of many people who made the code better - cedric lombardot (cedriclombardot) - Jonas Flodén (flojon) - Christian Schmidt + - Jakub Kucharovic (jkucharovic) - Marcin Sikoń (marphi) - Dominik Zogg (dominik.zogg) - Mathieu Lemoine @@ -348,10 +355,11 @@ Symfony is the result of the work of many people who made the code better - Sebastian Bergmann - Pablo Díez (pablodip) - Kevin McBride + - Ener-Getick (energetick) - Philipp Rieber (bicpi) - Manuel de Ruiter (manuel) - - Jérémy Romey (jeremyfreeagent) - Eduardo Oliveira (entering) + - Eugene Wissner - Iker Ibarguren (ikerib) - Ricardo Oliveira (ricardolotr) - ondrowan @@ -391,7 +399,6 @@ Symfony is the result of the work of many people who made the code better - MatTheCat - John Bafford (jbafford) - Denis Gorbachev (starfall) - - Titouan Galopin (tgalopin) - Steven Surowiec - Kevin Saliou (kbsali) - Ryan @@ -406,6 +413,7 @@ Symfony is the result of the work of many people who made the code better - Lenar Lõhmus - Benjamin Laugueux (yzalis) - Zach Badgett (zachbadgett) + - Loïc Faugeron - Aurélien Fredouelle - Pavel Campr (pcampr) - Johnny Robeson (johnny) @@ -434,7 +442,7 @@ Symfony is the result of the work of many people who made the code better - Wang Jingyu - Åsmund Garfors - Maxime Douailin - - Gregor Harlan + - Michael Hirschler (mvhirsch) - Javier López (loalf) - Reinier Kip - Dustin Dobervich (dustin10) @@ -450,7 +458,6 @@ Symfony is the result of the work of many people who made the code better - Tristan Maindron (tmaindron) - Ke WANG (yktd26) - Strate - - Jakub Kucharovic - Miquel Rodríguez Telep (mrtorrent) - Sergey Kolodyazhnyy (skolodyazhnyy) - umpirski @@ -465,7 +472,6 @@ Symfony is the result of the work of many people who made the code better - Sascha Grossenbacher - Szijarto Tamas - Benjamin Zikarsky (bzikarsky) - - Ben Davies (bendavies) - Mickaël Andrieu (mickaelandrieu) - Simon Schick (simonsimcity) - redstar504 @@ -485,13 +491,13 @@ Symfony is the result of the work of many people who made the code better - Mark Sonnabaum - Alexander Obuhovich (aik099) - jochenvdv - - Filippo Tessarotto - Arturas Smorgun (asarturas) - Alexander Volochnev (exelenz) - Michael Piecko - yclian - Sergio Santoro - Sebastian Grodzicki (sgrodzicki) + - Martin Hujer (martinhujer) - Pascal Helfenstein - Baldur Rensch (brensch) - Vladyslav Petrovych @@ -501,6 +507,7 @@ Symfony is the result of the work of many people who made the code better - Joshua Nye - Dave Marshall (davedevelopment) - avorobiev + - Gladhon - Venu - Lars Vierbergen - Dennis Hotson @@ -521,6 +528,7 @@ Symfony is the result of the work of many people who made the code better - Benoit Lévêque (benoit_leveque) - Jeroen Fiege (fieg) - Krzysiek Łabuś + - Ilya Antipenko (aivus) - Nicolas Dewez (nicolas_dewez) - Xavier Lacot (xavier) - Olivier Maisonneuve (olineuve) @@ -532,7 +540,6 @@ Symfony is the result of the work of many people who made the code better - fago - Harm van Tilborg - Jan Prieser - - Artur Melo (restless) - James Michael DuPont - Tom Klingenberg - Christopher Hall (mythmakr) @@ -566,6 +573,7 @@ Symfony is the result of the work of many people who made the code better - Aleksey Podskrebyshev - Steffen Roßkamp - David Marín Carreño (davefx) + - Hidde Boomsma (hboomsma) - Jörn Lang (j.lang) - mwsaz - Benoît Bourgeois @@ -609,6 +617,7 @@ Symfony is the result of the work of many people who made the code better - Benoît Merlet (trompette) - Koen Kuipers - datibbaw + - Sébastien Santoro - Raul Fraile (raulfraile) - sensio - Patrick Kaufmann @@ -628,6 +637,7 @@ Symfony is the result of the work of many people who made the code better - xaav - Jean-Christophe Cuvelier [Artack] - Mahmoud Mostafa (mahmoud) + - Pieter - Michael Tibben - Sander Marechal - Radosław Benkel @@ -635,7 +645,6 @@ Symfony is the result of the work of many people who made the code better - Mei Gwilym (meigwilym) - Michael H. Arieli (excelwebzone) - Luciano Mammino (loige) - - Michael Hirschler (mvhirsch) - fabios - Jérôme Vasseur - Sander Coolen (scoolen) @@ -646,6 +655,7 @@ Symfony is the result of the work of many people who made the code better - Irmantas Šiupšinskas (irmantas) - Charles-Henri Bruyand - Danilo Silva + - Konstantin S. M. Möllers (ksmmoellers) - Zachary Tong (polyfractal) - Hryhorii Hrebiniuk - dantleech @@ -679,6 +689,7 @@ Symfony is the result of the work of many people who made the code better - Max Beutel - Michal Trojanowski - Catalin Dan + - Mihai Stancu - nacho - Piotr Antosik (antek88) - Artem Lopata @@ -691,6 +702,7 @@ Symfony is the result of the work of many people who made the code better - Max Grigorian (maxakawizard) - benatespina (benatespina) - Denis Kop + - EdgarPE - jfcixmedia - Martijn Evers - Benjamin Paap (benjaminpaap) @@ -748,7 +760,6 @@ Symfony is the result of the work of many people who made the code better - Brooks Boyd - Roger Webb - Dmitriy Simushev - - Martin Hujer (martinhujer) - Max Voloshin (maxvoloshin) - Nicolas Fabre (nfabre) - Raul Rodriguez (raul782) @@ -765,6 +776,7 @@ Symfony is the result of the work of many people who made the code better - Philipp Strube - Christian Sciberras - Anton Bakai + - Chad Sikorra (chadsikorra) - Clement Herreman (clemherreman) - Nyro (nyro) - Trent Steel (trsteel88) @@ -779,6 +791,8 @@ Symfony is the result of the work of many people who made the code better - Jakub Kulhan - Mo Di (modi) - Jeroen van den Enden (stoefke) + - Christian Wahler + - Jelte Steijaert (jelte) - Quique Porta (quiqueporta) - Tomasz Szymczyk (karion) - ConneXNL @@ -796,6 +810,7 @@ Symfony is the result of the work of many people who made the code better - Sebastian Göttschkes (sgoettschkes) - Tatsuya Tsuruoka - Ross Tuck + - Zander Baldwin - Kévin Gomez (kevin) - azine - Dawid Sajdak @@ -835,11 +850,14 @@ Symfony is the result of the work of many people who made the code better - m.chwedziak - Philip Frank - Lance McNearney + - Dominik Ritter (dritter) - Frank Neff (fneff) + - Roman Lapin (memphys) - Giorgio Premi - caponica - Matt Daum (daum) - Alberto Pirovano (geezmo) + - Jules Pietri (heah) - Pete Mitchell (peterjmit) - Tom Corrigan (tomcorrigan) - Martin Pärtel @@ -868,6 +886,7 @@ Symfony is the result of the work of many people who made the code better - Adrien Samson (adriensamson) - Samuel Gordalina (gordalina) - Max Romanovsky (maxromanovsky) + - Dariusz Ruminski - Mathieu Morlon - Daniel Tschinder - Rafał Muszyński (rafmus90) @@ -948,6 +967,7 @@ Symfony is the result of the work of many people who made the code better - 2manypeople - Wing - Thomas Bibb + - Alessandro Chitolina - Matt Farmer - catch - Alexandre Segura @@ -965,6 +985,7 @@ Symfony is the result of the work of many people who made the code better - Michal Gebauer - Gleb Sidora - David Stone + - Adrien Lucas (adrienlucas) - Pablo Maria Martelletti (pmartelletti) - Yassine Guedidi (yguedidi) - Luis Muñoz @@ -977,6 +998,7 @@ Symfony is the result of the work of many people who made the code better - nuncanada - flack - František Bereň + - Almog Baku (almogbaku) - Christoph Nissle (derstoffel) - Ionel Scutelnicu (ionelscutelnicu) - Nicolas Tallefourtané (nicolab) @@ -1040,12 +1062,14 @@ Symfony is the result of the work of many people who made the code better - devel - Trevor Suarez - gedrox + - Mathieu MARCHOIS - dropfen - Andrey Chernykh - Edvinas Klovas - Drew Butler - J Bruni - Alexey Prilipko + - Oleg Voronkovich - bertillon - Victor Bocharsky (bocharsky_bw) - Luca Genuzio (genuzio) @@ -1092,6 +1116,7 @@ Symfony is the result of the work of many people who made the code better - Alex Pods - hadriengem - timaschew + - Jelle Kapitein - Ian Phillips - Haritz - Matthieu Prat @@ -1104,6 +1129,7 @@ Symfony is the result of the work of many people who made the code better - David Windell - Gabriel Birke - skafandri + - NothingWeAre - Alan Chen - Maerlyn - Even André Fiskvik @@ -1112,6 +1138,7 @@ Symfony is the result of the work of many people who made the code better - Lenar Lõhmus - Cristian Gonzalez - AlberT + - hainey - Juan M Martínez - Gilles Gauthier - ddebree @@ -1121,6 +1148,7 @@ Symfony is the result of the work of many people who made the code better - possum - Rafał - Adria Lopez (adlpz) + - Andreas Schempp (aschempp) - Rosio (ben-rosio) - Simon Paarlberg (blamh) - Jeroen Thora (bolle) @@ -1147,7 +1175,9 @@ Symfony is the result of the work of many people who made the code better - Pablo Monterde Perez (plebs) - Jimmy Leger (redpanda) - Pavel Batanov (scaytrase) + - Simone Di Maulo (toretto460) - Cyrille Jouineau (tuxosaurus) + - Sander Toonen (xatoo) - Yorkie Chadwick (yorkie76) - Yanick Witschi - Ondrej Mirtes @@ -1156,7 +1186,6 @@ Symfony is the result of the work of many people who made the code better - srsbiz - Taylan Kasap - Nicolas A. Bérard-Nault - - Gladhon - Saem Ghani - Stefan Oderbolz - Curtis @@ -1197,6 +1226,7 @@ Symfony is the result of the work of many people who made the code better - Vladimir Sazhin - lol768 - jamogon + - Antoine LA - Vyacheslav Slinko - Johannes - Jörg Rühl @@ -1209,6 +1239,7 @@ Symfony is the result of the work of many people who made the code better - Eric J. Duran - cmfcmf - Drew Butler + - pawel-lewtak - Steve Müller - Andras Ratz - andreabreu98 @@ -1219,7 +1250,6 @@ Symfony is the result of the work of many people who made the code better - Sam Williams - Adrian Philipp - James Michael DuPont - - Eugene Wissner - Kasperki - Tammy D - Ondrej Slinták @@ -1248,6 +1278,7 @@ Symfony is the result of the work of many people who made the code better - Norman Soetbeer - Benjamin Long - Matt Janssen + - Jeremy Benoist - Peter Gribanov - kwiateusz - David Soria Parra @@ -1267,6 +1298,7 @@ Symfony is the result of the work of many people who made the code better - Dawid Nowak - Richard Quadling - Karolis Daužickas + - Baptiste Lafontaine - tirnanog06 - phc - Дмитрий Пацура @@ -1314,6 +1346,7 @@ Symfony is the result of the work of many people who made the code better - Ismail Faizi (kanafghan) - Sébastien Armand (khepin) - Krzysztof Menżyk (krymen) + - Krzysztof Piasecki (krzysztek) - samuel laulhau (lalop) - Laurent Bachelier (laurentb) - Jérôme Parmentier (lctrs) diff --git a/LICENSE b/LICENSE index 43028bc600f26..12a74531e40a4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Fabien Potencier +Copyright (c) 2004-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index a115df128e6bb..d91b2d4cdab39 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -10,7 +10,7 @@ UPGRADE FROM 2.x to 3.0 | -------- | --- | `registerNamespaces()` | `addPrefixes()` | `registerPrefixes()` | `addPrefixes()` - | `registerNamespaces()` | `addPrefix()` + | `registerNamespace()` | `addPrefix()` | `registerPrefix()` | `addPrefix()` | `getNamespaces()` | `getPrefixes()` | `getNamespaceFallbacks()` | `getFallbackDirs()` @@ -20,6 +20,16 @@ UPGRADE FROM 2.x to 3.0 `DebugClassLoader`. The difference is that the constructor now takes a loader to wrap. +### Config + + * `\Symfony\Component\Config\Resource\ResourceInterface::isFresh()` has been removed. Also, + cache validation through this method (which was still supported in 2.8 for BC) does no longer + work because the `\Symfony\Component\Config\Resource\BCResourceInterfaceChecker` helper class + has been removed as well. + + * The `__toString()` method of the `\Symfony\Component\Config\ConfigCache` class + was removed in favor of the new `getPath()` method. + ### Console * The `dialog` helper has been removed in favor of the `question` helper. @@ -96,6 +106,79 @@ UPGRADE FROM 2.x to 3.0 * The method `remove` was added to `Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface`. + * The concept of scopes was removed, the removed methods are: + + - `Symfony\Component\DependencyInjection\ContainerBuilder::getScopes()` + - `Symfony\Component\DependencyInjection\ContainerBuilder::getScopeChildren()` + - `Symfony\Component\DependencyInjection\ContainerInterface::enterScope()` + - `Symfony\Component\DependencyInjection\ContainerInterface::leaveScope()` + - `Symfony\Component\DependencyInjection\ContainerInterface::addScope()` + - `Symfony\Component\DependencyInjection\ContainerInterface::hasScope()` + - `Symfony\Component\DependencyInjection\ContainerInterface::isScopeActive()` + - `Symfony\Component\DependencyInjection\Definition::setScope()` + - `Symfony\Component\DependencyInjection\Definition::getScope()` + - `Symfony\Component\DependencyInjection\Reference::isStrict()` + + Also, the `$scope` and `$strict` parameters of `Symfony\Component\DependencyInjection\ContainerInterface::set()` + and `Symfony\Component\DependencyInjection\Reference` respectively were removed. + + * A new `shared` flag has been added to the service definition + in replacement of the `prototype` scope. + + Before: + + ```php + use Symfony\Component\DependencyInjection\ContainerBuilder; + + $container = new ContainerBuilder(); + $container + ->register('foo', 'stdClass') + ->setScope(ContainerBuilder::SCOPE_PROTOTYPE) + ; + ``` + + ```yml + services: + foo: + class: stdClass + scope: prototype + ``` + + ```xml + + + + ``` + + After: + + ```php + use Symfony\Component\DependencyInjection\ContainerBuilder; + + $container = new ContainerBuilder(); + $container + ->register('foo', 'stdClass') + ->setShared(false) + ; + ``` + + ```yml + services: + foo: + class: stdClass + shared: false + ``` + + ```xml + + + + ``` + + * `Symfony\Component\DependencyInjection\ContainerAware` was removed, use + `Symfony\Component\DependencyInjection\ContainerAwareTrait` or implement + `Symfony\Component\DependencyInjection\ContainerAwareInterface` manually + * The methods `Definition::setFactoryClass()`, `Definition::setFactoryMethod()`, and `Definition::setFactoryService()` have been removed in favor of `Definition::setFactory()`. Services defined using @@ -121,6 +204,26 @@ UPGRADE FROM 2.x to 3.0 $crawler->getIterator()->current(); ``` +### DoctrineBridge + + * The `property` option of `DoctrineType` was removed in favor of the `choice_label` option. + + * The `loader` option of `DoctrineType` was removed. You now have to override the `getLoader()` + method in your custom type. + + * The `Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList` was removed in favor + of `Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader`. + + * Passing a query builder closure to `ORMQueryBuilderLoader` is not supported anymore. + You should pass resolved query builders only. + + Consequently, the arguments `$manager` and `$class` of `ORMQueryBuilderLoader` + have been removed as well. + + Note that the `query_builder` option of `DoctrineType` *does* support + closures, but the closure is now resolved in the type instead of in the + loader. + ### EventDispatcher * The method `getListenerPriority($eventName, $listener)` has been added to the @@ -131,17 +234,184 @@ UPGRADE FROM 2.x to 3.0 ### Form * The `getBlockPrefix()` method was added to the `FormTypeInterface` in replacement of - the `getName()` method which has been has been removed. + the `getName()` method which has been removed. + * The `configureOptions()` method was added to the `FormTypeInterface` in replacement of the `setDefaultOptions()` method which has been removed. + * The `getBlockPrefix()` method was added to the `ResolvedFormTypeInterface` in - replacement of the `getName()` method which has been has been removed. + replacement of the `getName()` method which has been removed. + + * The option `options` of the `CollectionType` has been removed in favor + of the `entry_options` option. + + * The `cascade_validation` option was removed. Use the `constraints` option + together with the `Valid` constraint instead. + + * Type names were removed. Instead of referencing types by name, you must + reference them by their fully-qualified class name (FQCN) instead: + + Before: + + ```php + $form = $this->createFormBuilder() + ->add('name', 'text') + ->add('age', 'integer') + ->getForm(); + ``` + + After: + + ```php + use Symfony\Component\Form\Extension\Core\Type\IntegerType; + use Symfony\Component\Form\Extension\Core\Type\TextType; + + $form = $this->createFormBuilder() + ->add('name', TextType::class) + ->add('age', IntegerType::class) + ->getForm(); + ``` + + If you want to customize the block prefix of a type in Twig, you must now + implement `FormTypeInterface::getBlockPrefix()`: + + Before: + + ```php + class UserProfileType extends AbstractType + { + public function getName() + { + return 'profile'; + } + } + ``` + + After: + + ```php + class UserProfileType extends AbstractType + { + public function getBlockPrefix() + { + return 'profile'; + } + } + ``` + + If you don't customize `getBlockPrefix()`, it defaults to the class name + without "Type" suffix in underscore notation (here: "user_profile"). + + Type extension must return the fully-qualified class name of the extended + type from `FormTypeExtensionInterface::getExtendedType()` now. + + Before: + + ```php + class MyTypeExtension extends AbstractTypeExtension + { + public function getExtendedType() + { + return 'form'; + } + } + ``` + + After: + + ```php + use Symfony\Component\Form\Extension\Core\Type\FormType; + + class MyTypeExtension extends AbstractTypeExtension + { + public function getExtendedType() + { + return FormType::class; + } + } + ``` + + * The `FormTypeInterface::getName()` method was removed. + + * Returning type instances from `FormTypeInterface::getParent()` is not + supported anymore. Return the fully-qualified class name of the parent + type class instead. + + Before: + + ```php + class MyType + { + public function getParent() + { + return new ParentType(); + } + } + ``` + + After: + + ```php + class MyType + { + public function getParent() + { + return ParentType::class; + } + } + ``` + + * The option `type` of the `CollectionType` has been removed in favor of + the `entry_type` option. The value for the `entry_type` option must be + the fully-qualified class name (FQCN). + + * Passing type instances to `Form::add()`, `FormBuilder::add()` and the + `FormFactory::create*()` methods is not supported anymore. Pass the + fully-qualified class name of the type instead. + + Before: + + ```php + $form = $this->createForm(new MyType()); + ``` + + After: + + ```php + $form = $this->createForm(MyType::class); + ``` + + * The alias option of the `form.type_extension` tag was removed in favor of + the `extended_type`/`extended-type` option. + + Before: + ```xml + + + + ``` + + After: + ```xml + + + + ``` + + * The `ChoiceToBooleanArrayTransformer`, `ChoicesToBooleanArrayTransformer`, + `FixRadioInputListener`, and `FixCheckboxInputListener` classes were removed. + + * The `choice_list` option of `ChoiceType` was removed. + +>>>>>>> 2.8 * The option "precision" was renamed to "scale". Before: ```php - $builder->add('length', 'number', array( + use Symfony\Component\Form\Extension\Core\Type\NumberType; + + $builder->add('length', NumberType::class, array( 'precision' => 3, )); ``` @@ -149,7 +419,9 @@ UPGRADE FROM 2.x to 3.0 After: ```php - $builder->add('length', 'number', array( + use Symfony\Component\Form\Extension\Core\Type\NumberType; + + $builder->add('length', NumberType::class, array( 'scale' => 3, )); ``` @@ -159,7 +431,9 @@ UPGRADE FROM 2.x to 3.0 Before: ```php - $builder->add('address', 'form', array( + use Symfony\Component\Form\Extension\Core\Type\FormType; + + $builder->add('address', FormType::class, array( 'virtual' => true, )); ``` @@ -167,7 +441,9 @@ UPGRADE FROM 2.x to 3.0 After: ```php - $builder->add('address', 'form', array( + use Symfony\Component\Form\Extension\Core\Type\FormType; + + $builder->add('address', FormType::class, array( 'inherit_data' => true, )); ``` @@ -294,12 +570,12 @@ UPGRADE FROM 2.x to 3.0 // ... } ``` - + * The option "options" of the CollectionType has been renamed to "entry_options". * The option "type" of the CollectionType has been renamed to "entry_type". - As a value for the option you must provide the fully-qualified class name (FQCN) - now as well. + As a value for the option you must provide the fully-qualified class name (FQCN) + now as well. * The `FormIntegrationTestCase` and `FormPerformanceTestCase` classes were moved form the `Symfony\Component\Form\Tests` namespace to the `Symfony\Component\Form\Test` namespace. @@ -307,11 +583,11 @@ UPGRADE FROM 2.x to 3.0 `NumberToLocalizedStringTransformer` were renamed to `ROUND_HALF_EVEN`, `ROUND_HALF_UP` and `ROUND_HALF_DOWN`. - * The methods `ChoiceListInterface::getIndicesForChoices()` and - `ChoiceListInterface::getIndicesForValues()` were removed. No direct - replacement exists, although in most cases - `ChoiceListInterface::getChoicesForValues()` and - `ChoiceListInterface::getValuesForChoices()` should be sufficient. + * The `Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface` was + removed in favor of `Symfony\Component\Form\ChoiceList\ChoiceListInterface`. + + * `Symfony\Component\Form\Extension\Core\View\ChoiceView` was removed in favor of + `Symfony\Component\Form\ChoiceList\View\ChoiceView`. * The interface `Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface` and all of its implementations were removed. Use the new interface @@ -347,8 +623,8 @@ UPGRADE FROM 2.x to 3.0 * The `Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList` class has been removed in favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`. - - * The `TimezoneType::getTimezones()` method was removed. You should not use + + * The `TimezoneType::getTimezones()` method was removed. You should not use this method. * The `Symfony\Component\Form\ChoiceList\ArrayKeyChoiceList` class has been removed in @@ -395,11 +671,11 @@ UPGRADE FROM 2.x to 3.0 } } ``` - + * In Symfony 2.7 a small BC break was introduced with the new choices_as_values option. In order to have the choice values populated to the html value attribute you had to define the choice_value option. This is now not any more needed. - + Before: ```php @@ -419,9 +695,9 @@ UPGRADE FROM 2.x to 3.0 }, )); ``` - + After: - + ```php $form->add('status', ChoiceType::class, array( 'choices' => array( @@ -430,56 +706,11 @@ UPGRADE FROM 2.x to 3.0 'Ignored' => Status::IGNORED, ) )); - ``` + ``` * The `request` service was removed. You must inject the `request_stack` service instead. - * The `templating.helper.assets` was removed in Symfony 3.0. You should - use the `assets.package` service instead. - - Before: - - ```php - use Symfony\Component\Templating\Helper\CoreAssetsHelper; - - class DemoService - { - private $assetsHelper; - - public function __construct(CoreAssetsHelper $assetsHelper) - { - $this->assetsHelper = $assetsHelper; - } - - public function testMethod() - { - return $this->assetsHelper->getUrl('thumbnail.png', null, $this->assetsHelper->getVersion()); - } - } - ``` - - After: - - ```php - use Symfony\Component\Asset\Packages; - - class DemoService - { - private $assetPackages; - - public function __construct(Packages $assetPackages) - { - $this->assetPackages = $assetPackages; - } - - public function testMethod() - { - return $this->assetPackages->getUrl('thumbnail.png').$this->assetPackages->getVersion(); - } - } - ``` - * The `enctype` method of the `form` helper was removed. You should use the new method `start` instead. @@ -549,6 +780,27 @@ UPGRADE FROM 2.x to 3.0 interface. The `security.csrf.token_manager` should be used instead. + * The `validator.mapping.cache.apc` service has been removed in favor of the `validator.mapping.cache.doctrine.apc` one. + + * The ability to pass `apc` as the `framework.validation.cache` configuration key value has been removed. + Use `validator.mapping.cache.doctrine.apc` instead: + + Before: + + ```yaml + framework: + validation: + cache: apc + ``` + + After: + + ```yaml + framework: + validation: + cache: validator.mapping.cache.doctrine.apc + ``` + ### HttpKernel * The `Symfony\Component\HttpKernel\Log\LoggerInterface` has been removed in @@ -624,7 +876,7 @@ UPGRADE FROM 2.x to 3.0 * Some route settings have been renamed: - * The `pattern` setting for a route has been deprecated in favor of `path` + * The `pattern` setting has been removed in favor of `path` * The `_scheme` and `_method` requirements have been moved to the `schemes` and `methods` settings Before: @@ -677,12 +929,17 @@ UPGRADE FROM 2.x to 3.0 the performance gains were minimal and it's hard to replicate the behaviour of PHP implementation. + * The `getMatcherDumperInstance()` and `getGeneratorDumperInstance()` methods in the + `Symfony\Component\Routing\Router` have been changed from `public` to `protected`. + ### Security * The `vote()` method from the `VoterInterface` was changed to now accept arbitrary types and not only objects. You can rely on the new abstract `Voter` class introduced in 2.8 to ease integrating your own voters. + * The `AbstractVoter` class was removed in favor of the new `Voter` class. + * The `Resources/` directory was moved to `Core/Resources/` * The `key` settings of `anonymous`, `remember_me` and `http_digest` are @@ -774,8 +1031,12 @@ UPGRADE FROM 2.x to 3.0 )); ``` - * The `AbstractVoter::getSupportedAttributes()` and `AbstractVoter::getSupportedClasses()` - methods have been removed in favor of `AbstractVoter::supports()`. + * The `AbstractVoter` class was removed. Instead, extend the new `Voter` class, + introduced in 2.8, and move your voting logic to the to the `supports($attribute, $subject)` + and `voteOnAttribute($attribute, $object, TokenInterface $token)` methods. + + * The `supportsClass` and `supportsAttribute` methods were + removed from the `VoterInterface` interface. Before: @@ -799,14 +1060,19 @@ UPGRADE FROM 2.x to 3.0 After: ```php - class MyVoter extends AbstractVoter + use Symfony\Component\Security\Core\Authorization\Voter\Voter; + + class MyVoter extends Voter { protected function supports($attribute, $object) { return $object instanceof Post && in_array($attribute, array('CREATE', 'EDIT')); } - // ... + protected function voteOnAttribute($attribute, $object, TokenInterface $token) + { + // Return true or false + } } ``` @@ -843,6 +1109,26 @@ UPGRADE FROM 2.x to 3.0 * The `supportsAttribute()` and `supportsClass()` methods of classes `AuthenticatedVoter`, `ExpressionVoter` and `RoleVoter` have been removed. + * The `intention` option was renamed to `csrf_token_id` for all the authentication listeners. + + * The `csrf_provider` option was renamed to `csrf_token_generator` for all the authentication listeners. + +### SecurityBundle + + * The `intention` firewall listener setting was renamed to `csrf_token_id`. + + * The `csrf_provider` firewall listener setting was renamed to `csrf_token_generator`. + +### Serializer + + * The `setCamelizedAttributes()` method of the + `Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer` and + `Symfony\Component\Serializer\Normalizer\PropertyNormalizer` classes + was removed. + + * The `Symfony\Component\Serializer\Exception\Exception` interface was removed + in favor of the new `Symfony\Component\Serializer\Exception\ExceptionInterface`. + ### Translator * The `Translator::setFallbackLocale()` method has been removed in favor of @@ -910,6 +1196,10 @@ UPGRADE FROM 2.x to 3.0 } ``` + * The `getMessages()` method of the `Symfony\Component\Translation\Translator` + class was removed. You should use the `getCatalogue()` method of the + `Symfony\Component\Translation\TranslatorBagInterface`. + ### Twig Bridge * The `twig:lint` command has been deprecated since Symfony 2.7 and will be @@ -969,11 +1259,18 @@ UPGRADE FROM 2.x to 3.0 ### TwigBundle + * The `Symfony\Bundle\TwigBundle\TwigDefaultEscapingStrategy` was removed + in favor of `Twig_FileExtensionEscapingStrategy`. + * The `twig:debug` command has been deprecated since Symfony 2.7 and will be removed in Symfony 3.0. Use the `debug:twig` command instead. ### Validator + * The PHP7-incompatible constraints (`Null`, `True`, `False`) and their related + validators (`NullValidator`, `TrueValidator`, `FalseValidator`) have been + removed in favor of their `Is`-prefixed equivalent. + * The class `Symfony\Component\Validator\Mapping\Cache\ApcCache` has been removed in favor of `Symfony\Component\Validator\Mapping\Cache\DoctrineCache`. @@ -1439,6 +1736,23 @@ UPGRADE FROM 2.x to 3.0 Yaml::parse(file_get_contents($fileName)); ``` +### WebProfiler + + * The `profiler:import` and `profiler:export` commands have been deprecated and + will be removed in 3.0. + + * All the profiler storages different than `FileProfilerStorage` have been + removed. The removed classes are: + + - `Symfony\Component\HttpKernel\Profiler\BaseMemcacheProfilerStorage` + - `Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage` + - `Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage` + - `Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage` + - `Symfony\Component\HttpKernel\Profiler\MysqlProfilerStorage` + - `Symfony\Component\HttpKernel\Profiler\PdoProfilerStorage` + - `Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage` + - `Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage` + ### Process * `Process::setStdin()` and `Process::getStdin()` have been removed. Use @@ -1459,10 +1773,3 @@ UPGRADE FROM 2.x to 3.0 ### HttpFoundation * `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` no longer implements the `IteratorAggregate` interface. Use the `all()` method instead of iterating over the flash bag. - -### Config - - * `\Symfony\Component\Config\Resource\ResourceInterface::isFresh()` has been removed. Also, - cache validation through this method (which was still supported in 2.8 for BC) does no longer - work because the `\Symfony\Component\Config\Resource\BCResourceInterfaceChecker` helper class - has been removed as well. diff --git a/appveyor.yml b/appveyor.yml index de3093f45ff80..6456c27916d13 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,6 +14,7 @@ init: - SET PHP=1 - SET ANSICON=121x90 (121x90) - SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped + - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f install: - IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php) @@ -46,13 +47,14 @@ install: - appveyor DownloadFile https://getcomposer.org/composer.phar - copy /Y php.ini-max php.ini - cd c:\projects\symfony + - mkdir %APPDATA%\Composer + - IF %APPVEYOR_REPO_NAME%==symfony/symfony copy /Y .composer-auth.json %APPDATA%\Composer\auth.json - php phpunit install - IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev) - - composer update --prefer-source --no-progress --ansi + - composer update --prefer-dist --no-progress --ansi test_script: - cd c:\projects\symfony - - Setlocal EnableDelayedExpansion - SET X=0 - copy /Y c:\php\php.ini-min c:\php\php.ini - php phpunit symfony --exclude-group benchmark,intl-data || SET X=!errorlevel! diff --git a/composer.json b/composer.json index da34246718a27..7fe4d1436a671 100644 --- a/composer.json +++ b/composer.json @@ -80,6 +80,7 @@ "monolog/monolog": "~1.11", "ocramius/proxy-manager": "~0.4|~1.0", "egulias/email-validator": "~1.2", + "symfony/polyfill-apcu": "~1.1", "symfony/security-acl": "~2.8|~3.0", "phpdocumentor/reflection": "^1.0.7" }, @@ -91,7 +92,6 @@ "Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/", "Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/", "Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/", - "Symfony\\Bridge\\Swiftmailer\\": "src/Symfony/Bridge/Swiftmailer/", "Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/", "Symfony\\Bundle\\": "src/Symfony/Bundle/", "Symfony\\Component\\": "src/Symfony/Component/" diff --git a/phpunit b/phpunit index 146ab9d37610c..dba1222189066 100755 --- a/phpunit +++ b/phpunit @@ -27,7 +27,7 @@ if ('phpdbg' === PHP_SAPI) { $PHP .= ' -qrr'; } -$COMPOSER = file_exists($COMPOSER = __DIR__.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `where.exe composer.phar` : `which composer.phar`)) +$COMPOSER = file_exists($COMPOSER = __DIR__.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar`)) ? $PHP.' '.ProcessUtils::escapeArgument($COMPOSER) : 'composer'; @@ -53,7 +53,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__ chdir("phpunit-$PHPUNIT_VERSION"); passthru("$COMPOSER remove --no-update symfony/yaml"); passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=2.8@dev\""); - passthru("$COMPOSER install --prefer-source --no-progress --ansi"); + passthru("$COMPOSER install --prefer-dist --no-progress --ansi"); file_put_contents('phpunit', <<getFilename()); + $bundleDir = dirname($bundle->getFileName()); if (!$bundleConfig['type']) { $bundleConfig['type'] = $this->detectMetadataDriver($bundleDir, $container); diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php index de35c55219f2e..96f05eb5b60c9 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php @@ -60,7 +60,7 @@ private function updateValidatorMappingFiles(ContainerBuilder $container, $mappi foreach ($container->getParameter('kernel.bundles') as $bundle) { $reflection = new \ReflectionClass($bundle); - if (is_file($file = dirname($reflection->getFilename()).'/'.$validationPath)) { + if (is_file($file = dirname($reflection->getFileName()).'/'.$validationPath)) { $files[] = realpath($file); $container->addResource(new FileResource($file)); } diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index 353c18528710f..9b3c50307ce61 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -111,7 +111,12 @@ public function getQueryBuilderPartsForCachingHash($queryBuilder) public function __construct(ManagerRegistry $registry, PropertyAccessorInterface $propertyAccessor = null, ChoiceListFactoryInterface $choiceListFactory = null) { $this->registry = $registry; - $this->choiceListFactory = $choiceListFactory ?: new PropertyAccessDecorator(new DefaultChoiceListFactory(), $propertyAccessor); + $this->choiceListFactory = $choiceListFactory ?: new CachingFactoryDecorator( + new PropertyAccessDecorator( + new DefaultChoiceListFactory(), + $propertyAccessor + ) + ); } public function buildForm(FormBuilderInterface $builder, array $options) diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php index f0c8a9e785157..21f1860efd6e8 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Doctrine\Form\Type; use Doctrine\Common\Persistence\ObjectManager; +use Doctrine\ORM\Query\Parameter; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader; use Symfony\Component\Form\Exception\UnexpectedTypeException; @@ -78,8 +79,20 @@ public function getBlockPrefix() public function getQueryBuilderPartsForCachingHash($queryBuilder) { return array( - $queryBuilder->getQuery()->getSQL(), - $queryBuilder->getParameters()->toArray(), + $queryBuilder->getQuery()->getSQL(), + array_map(array($this, 'parameterToArray'), $queryBuilder->getParameters()->toArray()), ); } + + /** + * Converts a query parameter to an array. + * + * @param Parameter $parameter The query parameter + * + * @return array The array representation of the parameter + */ + private function parameterToArray(Parameter $parameter) + { + return array($parameter->getName(), $parameter->getType(), $parameter->getValue()); + } } diff --git a/src/Symfony/Bridge/Doctrine/LICENSE b/src/Symfony/Bridge/Doctrine/LICENSE index 43028bc600f26..12a74531e40a4 100644 --- a/src/Symfony/Bridge/Doctrine/LICENSE +++ b/src/Symfony/Bridge/Doctrine/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Fabien Potencier +Copyright (c) 2004-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php index 51f9f75e4b62c..18fb341e5b74c 100644 --- a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php +++ b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php @@ -49,12 +49,8 @@ public function startQuery($sql, array $params = null, array $types = null) $this->stopwatch->start('doctrine', 'doctrine'); } - if (is_array($params)) { - $params = $this->normalizeParams($params); - } - if (null !== $this->logger) { - $this->log($sql, null === $params ? array() : $params); + $this->log($sql, null === $params ? array() : $this->normalizeParams($params)); } } diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php index dc22e235959bd..6e330e558aa06 100644 --- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php +++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php @@ -14,6 +14,7 @@ use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\ORM\Mapping\ClassMetadataInfo; +use Doctrine\ORM\Mapping\MappingException as OrmMappingException; use Symfony\Component\PropertyInfo\PropertyListExtractorInterface; use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface; use Symfony\Component\PropertyInfo\Type; @@ -44,6 +45,8 @@ public function getProperties($class, array $context = array()) $metadata = $this->classMetadataFactory->getMetadataFor($class); } catch (MappingException $exception) { return; + } catch (OrmMappingException $exception) { + return; } return array_merge($metadata->getFieldNames(), $metadata->getAssociationNames()); @@ -58,6 +61,8 @@ public function getTypes($class, $property, array $context = array()) $metadata = $this->classMetadataFactory->getMetadataFor($class); } catch (MappingException $exception) { return; + } catch (OrmMappingException $exception) { + return; } if ($metadata->hasAssociation($property)) { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index d090fd604f0f0..0303c355c055b 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -1127,6 +1127,69 @@ public function testLoaderCaching() $this->assertSame($choiceLoader1, $choiceLoader3); } + public function testLoaderCachingWithParameters() + { + $entity1 = new SingleIntIdEntity(1, 'Foo'); + $entity2 = new SingleIntIdEntity(2, 'Bar'); + $entity3 = new SingleIntIdEntity(3, 'Baz'); + + $this->persist(array($entity1, $entity2, $entity3)); + + $repo = $this->em->getRepository(self::SINGLE_IDENT_CLASS); + + $entityType = new EntityType( + $this->emRegistry, + PropertyAccess::createPropertyAccessor() + ); + + $entityTypeGuesser = new DoctrineOrmTypeGuesser($this->emRegistry); + + $factory = Forms::createFormFactoryBuilder() + ->addType($entityType) + ->addTypeGuesser($entityTypeGuesser) + ->getFormFactory(); + + $formBuilder = $factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType'); + + $formBuilder->add('property1', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array( + 'em' => 'default', + 'class' => self::SINGLE_IDENT_CLASS, + 'query_builder' => $repo->createQueryBuilder('e')->where('e.id = :id')->setParameter('id', 1), + )); + + $formBuilder->add('property2', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array( + 'em' => 'default', + 'class' => self::SINGLE_IDENT_CLASS, + 'query_builder' => function (EntityRepository $repo) { + return $repo->createQueryBuilder('e')->where('e.id = :id')->setParameter('id', 1); + }, + )); + + $formBuilder->add('property3', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array( + 'em' => 'default', + 'class' => self::SINGLE_IDENT_CLASS, + 'query_builder' => function (EntityRepository $repo) { + return $repo->createQueryBuilder('e')->where('e.id = :id')->setParameter('id', 1); + }, + )); + + $form = $formBuilder->getForm(); + + $form->submit(array( + 'property1' => 1, + 'property2' => 1, + 'property3' => 2, + )); + + $choiceLoader1 = $form->get('property1')->getConfig()->getOption('choice_loader'); + $choiceLoader2 = $form->get('property2')->getConfig()->getOption('choice_loader'); + $choiceLoader3 = $form->get('property3')->getConfig()->getOption('choice_loader'); + + $this->assertInstanceOf('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface', $choiceLoader1); + $this->assertSame($choiceLoader1, $choiceLoader2); + $this->assertSame($choiceLoader1, $choiceLoader3); + } + protected function createRegistryMock($name, $em) { $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php index df6c355895086..ac1bb5f96e41b 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php @@ -26,7 +26,7 @@ class DoctrineExtractorTest extends \PHPUnit_Framework_TestCase */ private $extractor; - public function setUp() + protected function setUp() { $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'), true); $entityManager = EntityManager::create(array('driver' => 'pdo_sqlite'), $config); @@ -81,4 +81,14 @@ public function typesProvider() array('notMapped', null), ); } + + public function testGetPropertiesCatchException() + { + $this->assertNull($this->extractor->getProperties('Not\Exist')); + } + + public function testGetTypesCatchException() + { + $this->assertNull($this->extractor->getTypes('Not\Exist', 'baz')); + } } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 8cf6ec0c8d1f7..201324126b081 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -11,11 +11,11 @@ namespace Symfony\Bridge\Doctrine\Tests\Validator\Constraints; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\Persistence\ObjectRepository; use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper; -use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity; @@ -330,6 +330,44 @@ public function testValidateUniquenessWithUnrewoundArray() $this->assertNoViolation(); } + /** + * @dataProvider resultTypesProvider + */ + public function testValidateResultTypes($entity1, $result) + { + $constraint = new UniqueEntity(array( + 'message' => 'myMessage', + 'fields' => array('name'), + 'em' => self::EM_NAME, + 'repositoryMethod' => 'findByCustom', + )); + + $repository = $this->createRepositoryMock(); + $repository->expects($this->once()) + ->method('findByCustom') + ->will($this->returnValue($result)) + ; + $this->em = $this->createEntityManagerMock($repository); + $this->registry = $this->createRegistryMock($this->em); + $this->validator = $this->createValidator(); + $this->validator->initialize($this->context); + + $this->validator->validate($entity1, $constraint); + + $this->assertNoViolation(); + } + + public function resultTypesProvider() + { + $entity = new SingleIntIdEntity(1, 'foo'); + + return array( + array($entity, array($entity)), + array($entity, new \ArrayIterator(array($entity))), + array($entity, new ArrayCollection(array($entity))), + ); + } + public function testAssociatedEntity() { $constraint = new UniqueEntity(array( @@ -359,7 +397,7 @@ public function testAssociatedEntity() $this->buildViolation('myMessage') ->atPath('property.path.single') - ->setInvalidValue(1) + ->setInvalidValue($entity1) ->assertRaised(); } @@ -383,29 +421,6 @@ public function testAssociatedEntityWithNull() $this->assertNoViolation(); } - /** - * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException - * @expectedExceptionMessage Associated entities are not allowed to have more than one identifier field - */ - public function testAssociatedCompositeEntity() - { - $constraint = new UniqueEntity(array( - 'message' => 'myMessage', - 'fields' => array('composite'), - 'em' => self::EM_NAME, - )); - - $composite = new CompositeIntIdEntity(1, 1, 'test'); - $associated = new AssociationEntity(); - $associated->composite = $composite; - - $this->em->persist($composite); - $this->em->persist($associated); - $this->em->flush(); - - $this->validator->validate($associated, $constraint); - } - /** * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException * @expectedExceptionMessage Object manager "foo" does not exist. diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index 0fbf42c5bec65..3936b5fd806a7 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -12,7 +12,6 @@ namespace Symfony\Bridge\Doctrine\Validator\Constraints; use Doctrine\Common\Persistence\ManagerRegistry; -use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; @@ -97,23 +96,16 @@ public function validate($entity, Constraint $constraint) * getter methods in the Proxy are being bypassed. */ $em->initializeObject($criteria[$fieldName]); - - $relatedClass = $em->getClassMetadata($class->getAssociationTargetClass($fieldName)); - $relatedId = $relatedClass->getIdentifierValues($criteria[$fieldName]); - - if (count($relatedId) > 1) { - throw new ConstraintDefinitionException( - 'Associated entities are not allowed to have more than one identifier field to be '. - 'part of a unique constraint in: '.$class->getName().'#'.$fieldName - ); - } - $criteria[$fieldName] = array_pop($relatedId); } } $repository = $em->getRepository(get_class($entity)); $result = $repository->{$constraint->repositoryMethod}($criteria); + if ($result instanceof \IteratorAggregate) { + $result = $result->getIterator(); + } + /* If the result is a MongoCursor, it must be advanced to the first * element. Rewinding should have no ill effect if $result is another * iterator implementation. @@ -135,16 +127,9 @@ public function validate($entity, Constraint $constraint) $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; $invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]]; - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->message) - ->atPath($errorPath) - ->setInvalidValue($invalidValue) - ->addViolation(); - } else { - $this->buildViolation($constraint->message) - ->atPath($errorPath) - ->setInvalidValue($invalidValue) - ->addViolation(); - } + $this->context->buildViolation($constraint->message) + ->atPath($errorPath) + ->setInvalidValue($invalidValue) + ->addViolation(); } } diff --git a/src/Symfony/Bridge/Monolog/LICENSE b/src/Symfony/Bridge/Monolog/LICENSE index 43028bc600f26..12a74531e40a4 100644 --- a/src/Symfony/Bridge/Monolog/LICENSE +++ b/src/Symfony/Bridge/Monolog/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Fabien Potencier +Copyright (c) 2004-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/PhpUnit/ClockMock.php b/src/Symfony/Bridge/PhpUnit/ClockMock.php index b81fee965880a..fe5cd851258d2 100644 --- a/src/Symfony/Bridge/PhpUnit/ClockMock.php +++ b/src/Symfony/Bridge/PhpUnit/ClockMock.php @@ -109,5 +109,4 @@ function usleep(\$us) ); } } - } diff --git a/src/Symfony/Bridge/PhpUnit/LICENSE b/src/Symfony/Bridge/PhpUnit/LICENSE index ef1cde91a61c3..39fa189d2b5fc 100644 --- a/src/Symfony/Bridge/PhpUnit/LICENSE +++ b/src/Symfony/Bridge/PhpUnit/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2015 Fabien Potencier +Copyright (c) 2014-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/PhpUnit/README.md b/src/Symfony/Bridge/PhpUnit/README.md index ef5f76f1a7f93..90dbe83bb8e79 100644 --- a/src/Symfony/Bridge/PhpUnit/README.md +++ b/src/Symfony/Bridge/PhpUnit/README.md @@ -5,7 +5,6 @@ Provides utilities for PHPUnit, especially user deprecation notices management. It comes with the following features: - * disable the garbage collector; * enforce a consistent `C` locale; * auto-register `class_exists` to load Doctrine annotations; * print a user deprecation notices summary at the end of the test suite; diff --git a/src/Symfony/Bridge/PhpUnit/bootstrap.php b/src/Symfony/Bridge/PhpUnit/bootstrap.php index c0abdaa700604..1283da08fa408 100644 --- a/src/Symfony/Bridge/PhpUnit/bootstrap.php +++ b/src/Symfony/Bridge/PhpUnit/bootstrap.php @@ -17,10 +17,6 @@ return; } -// Disabling Zend Garbage Collection to prevent segfaults with PHP5.4+ -// https://bugs.php.net/bug.php?id=53976 -gc_disable(); - // Enforce a consistent locale setlocale(LC_ALL, 'C'); diff --git a/src/Symfony/Bridge/ProxyManager/LICENSE b/src/Symfony/Bridge/ProxyManager/LICENSE index 43028bc600f26..12a74531e40a4 100644 --- a/src/Symfony/Bridge/ProxyManager/LICENSE +++ b/src/Symfony/Bridge/ProxyManager/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Fabien Potencier +Copyright (c) 2004-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php b/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php index ad7949dfaa682..69d6d326f4d08 100644 --- a/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php @@ -13,6 +13,7 @@ use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\RequestContext; /** * Twig extension for the Symfony HttpFoundation component. @@ -22,10 +23,12 @@ class HttpFoundationExtension extends \Twig_Extension { private $requestStack; + private $requestContext; - public function __construct(RequestStack $requestStack) + public function __construct(RequestStack $requestStack, RequestContext $requestContext = null) { $this->requestStack = $requestStack; + $this->requestContext = $requestContext; } /** @@ -57,6 +60,23 @@ public function generateAbsoluteUrl($path) } if (!$request = $this->requestStack->getMasterRequest()) { + if (null !== $this->requestContext && '' !== $host = $this->requestContext->getHost()) { + $scheme = $this->requestContext->getScheme(); + $port = ''; + + if ('http' === $scheme && 80 != $this->requestContext->getHttpPort()) { + $port = ':'.$this->requestContext->getHttpPort(); + } elseif ('https' === $scheme && 443 != $this->requestContext->getHttpsPort()) { + $port = ':'.$this->requestContext->getHttpsPort(); + } + + if ('/' !== $path[0]) { + $path = rtrim($this->requestContext->getBaseUrl(), '/').'/'.$path; + } + + return $scheme.'://'.$host.$port.$path; + } + return $path; } diff --git a/src/Symfony/Bridge/Twig/LICENSE b/src/Symfony/Bridge/Twig/LICENSE index 43028bc600f26..12a74531e40a4 100644 --- a/src/Symfony/Bridge/Twig/LICENSE +++ b/src/Symfony/Bridge/Twig/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Fabien Potencier +Copyright (c) 2004-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig index e997615d11378..5de20b1b8f181 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig @@ -65,6 +65,17 @@ col-sm-2 {% endspaceless %} {% endblock submit_row %} +{% block reset_row -%} +{% spaceless %} +
+
+
+ {{ form_widget(form) }} +
+
+{% endspaceless %} +{% endblock reset_row %} + {% block form_group_class -%} col-sm-10 {%- endblock form_group_class %} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index 165236ef613ec..5affc7a6a1b92 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -167,7 +167,14 @@ {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %} {% endif %} {% if label is not same as(false) and label is empty %} - {% set label = name|humanize %} + {%- if label_format is not empty -%} + {% set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) %} + {%- else -%} + {% set label = name|humanize %} + {%- endif -%} {% endif %} {{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}} diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig index 77e37da0205ce..dc7bec9fb6ccd 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/foundation_5_layout.html.twig @@ -249,7 +249,14 @@ {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ parent_label_class)|trim}) %} {% endif %} {% if label is empty %} - {% set label = name|humanize %} + {%- if label_format is not empty -%} + {% set label = label_format|replace({ + '%name%': name, + '%id%': id, + }) %} + {%- else -%} + {% set label = name|humanize %} + {%- endif -%} {% endif %} {{ widget|raw }} diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php new file mode 100644 index 0000000000000..51a95bc4b57e0 --- /dev/null +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -0,0 +1,150 @@ +appVariable = new AppVariable(); + } + + /** + * @dataProvider debugDataProvider + */ + public function testDebug($debugFlag) + { + $this->appVariable->setDebug($debugFlag); + + $this->assertEquals($debugFlag, $this->appVariable->getDebug()); + } + + public function debugDataProvider() + { + return array( + 'debug on' => array(true), + 'debug off' => array(false), + ); + } + + public function testEnvironment() + { + $this->appVariable->setEnvironment('dev'); + + $this->assertEquals('dev', $this->appVariable->getEnvironment()); + } + + public function testGetSession() + { + $request = $this->getMock('Symfony\Component\HttpFoundation\Request'); + $request->method('getSession')->willReturn($session = new Session()); + + $this->setRequestStack($request); + + $this->assertEquals($session, $this->appVariable->getSession()); + } + + public function testGetSessionWithNoRequest() + { + $this->setRequestStack(null); + + $this->assertNull($this->appVariable->getSession()); + } + + public function testGetRequest() + { + $this->setRequestStack($request = new Request()); + + $this->assertEquals($request, $this->appVariable->getRequest()); + } + + public function testGetUser() + { + $this->setTokenStorage($user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface')); + + $this->assertEquals($user, $this->appVariable->getUser()); + } + + public function testGetUserWithUsernameAsTokenUser() + { + $this->setTokenStorage($user = 'username'); + + $this->assertNull($this->appVariable->getUser()); + } + + public function testGetUserWithNoToken() + { + $tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'); + $this->appVariable->setTokenStorage($tokenStorage); + + $this->assertNull($this->appVariable->getUser()); + } + + /** + * @expectedException \RuntimeException + */ + public function testEnvironmentNotSet() + { + $this->appVariable->getEnvironment(); + } + + /** + * @expectedException \RuntimeException + */ + public function testDebugNotSet() + { + $this->appVariable->getDebug(); + } + + /** + * @expectedException \RuntimeException + */ + public function testGetUserWithTokenStorageNotSet() + { + $this->appVariable->getUser(); + } + + /** + * @expectedException \RuntimeException + */ + public function testGetRequestWithRequestStackNotSet() + { + $this->appVariable->getRequest(); + } + + /** + * @expectedException \RuntimeException + */ + public function testGetSessionWithRequestStackNotSet() + { + $this->appVariable->getSession(); + } + + protected function setRequestStack($request) + { + $requestStackMock = $this->getMock('Symfony\Component\HttpFoundation\RequestStack'); + $requestStackMock->method('getCurrentRequest')->willReturn($request); + + $this->appVariable->setRequestStack($requestStackMock); + } + + protected function setTokenStorage($user) + { + $tokenStorage = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'); + $this->appVariable->setTokenStorage($tokenStorage); + + $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); + $tokenStorage->method('getToken')->willReturn($token); + + $token->method('getUser')->willReturn($user); + } +} diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.php index 0c7cc1bd4168c..6d457e395b07e 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/ExpressionExtensionTest.php @@ -12,7 +12,6 @@ namespace Symfony\Bridge\Twig\Tests\Extension; use Symfony\Bridge\Twig\Extension\ExpressionExtension; -use Symfony\Component\ExpressionLanguage\Expression; class ExpressionExtensionTest extends \PHPUnit_Framework_TestCase { diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php index 91f978a909381..339d43d7c6bd1 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php @@ -14,6 +14,7 @@ use Symfony\Bridge\Twig\Extension\HttpFoundationExtension; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\RequestContext; class HttpFoundationExtensionTest extends \PHPUnit_Framework_TestCase { @@ -43,6 +44,49 @@ public function getGenerateAbsoluteUrlData() ); } + /** + * @dataProvider getGenerateAbsoluteUrlRequestContextData + */ + public function testGenerateAbsoluteUrlWithRequestContext($path, $baseUrl, $host, $scheme, $httpPort, $httpsPort, $expected) + { + if (!class_exists('Symfony\Component\Routing\RequestContext')) { + $this->markTestSkipped('The Routing component is needed to run tests that depend on its request context.'); + } + + $requestContext = new RequestContext($baseUrl, 'GET', $host, $scheme, $httpPort, $httpsPort, $path); + $extension = new HttpFoundationExtension(new RequestStack(), $requestContext); + + $this->assertEquals($expected, $extension->generateAbsoluteUrl($path)); + } + + /** + * @dataProvider getGenerateAbsoluteUrlRequestContextData + */ + public function testGenerateAbsoluteUrlWithoutRequestAndRequestContext($path) + { + if (!class_exists('Symfony\Component\Routing\RequestContext')) { + $this->markTestSkipped('The Routing component is needed to run tests that depend on its request context.'); + } + + $extension = new HttpFoundationExtension(new RequestStack()); + + $this->assertEquals($path, $extension->generateAbsoluteUrl($path)); + } + + public function getGenerateAbsoluteUrlRequestContextData() + { + return array( + array('/foo.png', '/foo', 'localhost', 'http', 80, 443, 'http://localhost/foo.png'), + array('foo.png', '/foo', 'localhost', 'http', 80, 443, 'http://localhost/foo/foo.png'), + array('foo.png', '/foo/bar/', 'localhost', 'http', 80, 443, 'http://localhost/foo/bar/foo.png'), + array('/foo.png', '/foo', 'localhost', 'https', 80, 443, 'https://localhost/foo.png'), + array('foo.png', '/foo', 'localhost', 'https', 80, 443, 'https://localhost/foo/foo.png'), + array('foo.png', '/foo/bar/', 'localhost', 'https', 80, 443, 'https://localhost/foo/bar/foo.png'), + array('/foo.png', '/foo', 'localhost', 'http', 443, 80, 'http://localhost:443/foo.png'), + array('/foo.png', '/foo', 'localhost', 'https', 443, 80, 'https://localhost:80/foo.png'), + ); + } + public function testGenerateAbsoluteUrlWithScriptFileName() { $request = Request::create('http://localhost/app/web/app_dev.php'); diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index f4a6dbf21ffa4..a02edc777a1bf 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -87,17 +87,17 @@ public function getTransTests() // transchoice array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0),), + 'There is no apples', array('count' => 0)), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5),), + 'There is 5 apples', array('count' => 5)), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony'),), + 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5),), + 'There is 5 apples (Symfony)', array('count' => 5)), array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0),), + 'There is no apples', array('count' => 0)), array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples',), + 'There is 5 apples'), // trans filter array('{{ "Hello"|trans }}', 'Hello'), diff --git a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php index 2281444e97d3c..1dc7056e15a4a 100644 --- a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php @@ -36,6 +36,7 @@ public function testCompileStrict() trim($compiler->compile($node)->getSource()) ); } + protected function getVariableGetterWithoutStrictCheck($name) { return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); diff --git a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php index a6169889c4a75..ce6d1b7c677e4 100644 --- a/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php +++ b/src/Symfony/Bundle/DebugBundle/DependencyInjection/DebugExtension.php @@ -13,9 +13,9 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * DebugExtension. diff --git a/src/Symfony/Bundle/DebugBundle/Resources/meta/LICENSE b/src/Symfony/Bundle/DebugBundle/LICENSE similarity index 96% rename from src/Symfony/Bundle/DebugBundle/Resources/meta/LICENSE rename to src/Symfony/Bundle/DebugBundle/LICENSE index ef1cde91a61c3..39fa189d2b5fc 100644 --- a/src/Symfony/Bundle/DebugBundle/Resources/meta/LICENSE +++ b/src/Symfony/Bundle/DebugBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014-2015 Fabien Potencier +Copyright (c) 2014-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php index 6b20a42f45073..758b25c58d6e3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AbstractConfigCommand.php @@ -29,7 +29,13 @@ protected function listBundles($output) { $headers = array('Bundle name', 'Extension alias'); $rows = array(); - foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) { + + $bundles = $this->getContainer()->get('kernel')->getBundles(); + usort($bundles, function($bundleA, $bundleB) { + return strcmp($bundleA->getName(), $bundleB->getName()); + }); + + foreach ($bundles as $bundle) { $extension = $bundle->getContainerExtension(); $rows[] = array($bundle->getName(), $extension ? $extension->getAlias() : ''); } @@ -45,26 +51,29 @@ protected function listBundles($output) protected function findExtension($name) { - $extension = null; $bundles = $this->initializeBundles(); foreach ($bundles as $bundle) { - $extension = $bundle->getContainerExtension(); + if ($name === $bundle->getName()) { + if (!$bundle->getContainerExtension()) { + throw new \LogicException(sprintf('Bundle "%s" does not have a container extension.', $name)); + } - if ($extension && ($name === $extension->getAlias() || $name === $bundle->getName())) { - break; + return $bundle->getContainerExtension(); } - } - if (!$extension) { - $message = sprintf('No extension with alias "%s" is enabled', $name); - if (preg_match('/Bundle$/', $name)) { - $message = sprintf('No extensions with configuration available for "%s"', $name); + $extension = $bundle->getContainerExtension(); + if ($extension && $name === $extension->getAlias()) { + return $extension; } + } - throw new \LogicException($message); + if ('Bundle' !== substr($name, -6)) { + $message = sprintf('No extensions with configuration available for "%s"', $name); + } else { + $message = sprintf('No extension with alias "%s" is enabled', $name); } - return $extension; + throw new \LogicException($message); } public function validateConfiguration(ExtensionInterface $extension, $configuration) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 647dc0fd58506..9f36c8d714d72 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -11,7 +11,6 @@ namespace Symfony\Bundle\FrameworkBundle\Command; -use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -52,7 +51,7 @@ protected function configure() ->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it') ->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks') ->setDescription('Installs bundles web assets under a public web directory') - ->setHelp(<<setHelp(<<<'EOT' The %command.name% command installs bundle assets into a given directory (e.g. the web directory). diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index 71208b30929fc..eb8bbbadb2891 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -38,7 +38,7 @@ protected function configure() new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'), )) ->setDescription('Clears the cache') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% command clears the application cache for a given environment and debug mode: @@ -164,9 +164,18 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr } // fix references to kernel/container related classes - $search = $tempKernel->getName().ucfirst($tempKernel->getEnvironment()); - $replace = $realKernel->getName().ucfirst($realKernel->getEnvironment()); - foreach (Finder::create()->files()->name($search.'*')->in($warmupDir) as $file) { + $fileSearch = $tempKernel->getName().ucfirst($tempKernel->getEnvironment()).'*'; + $search = array( + $tempKernel->getName().ucfirst($tempKernel->getEnvironment()), + sprintf('\'kernel.name\' => \'%s\'', $tempKernel->getName()), + sprintf('key="kernel.name">%s<', $tempKernel->getName()), + ); + $replace = array( + $realKernel->getName().ucfirst($realKernel->getEnvironment()), + sprintf('\'kernel.name\' => \'%s\'', $realKernel->getName()), + sprintf('key="kernel.name">%s<', $realKernel->getName()), + ); + foreach (Finder::create()->files()->name($fileSearch)->in($warmupDir) as $file) { $content = str_replace($search, $replace, file_get_contents($file)); file_put_contents(str_replace($search, $replace, $file), $content); unlink($file); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php index fdbf9d6d7be97..1e0c4b6b3a251 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php @@ -34,7 +34,7 @@ protected function configure() new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'), )) ->setDescription('Warms up an empty cache') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% command warms up the cache. Before running this command, the cache must be empty. diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php index 93c46bf2feb29..cec154a72fe7a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php @@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->title(sprintf('Current configuration for "%s"', $name)); } - $io->writeln(Yaml::dump(array($extension->getAlias() => $config), 3)); + $io->writeln(Yaml::dump(array($extension->getAlias() => $config), 10)); } private function compileContainer() diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php index 6b1d9ea2c19b1..1d015c94ac0b4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php @@ -40,7 +40,7 @@ protected function configure() new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (yaml or xml)', 'yaml'), )) ->setDescription('Dumps the default configuration for an extension') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% command dumps the default configuration for an extension/bundle. diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index b8413a4ee41f6..f88ecd6cd4530 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -51,7 +51,7 @@ protected function configure() new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'), )) ->setDescription('Displays current services for an application') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% command displays all configured public services: php %command.full_name% diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php index d8c97a331adf1..d0b4241a36bb3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php @@ -58,7 +58,7 @@ protected function configure() new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw route(s)'), )) ->setDescription('Displays current routes for an application') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% displays the configured routes: php %command.full_name% diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php index 7b17e2529436c..2e23ad72c2aef 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterMatchCommand.php @@ -57,7 +57,7 @@ protected function configure() new InputOption('host', null, InputOption::VALUE_REQUIRED, 'Sets the URI host'), )) ->setDescription('Helps debug routes by simulating a path info match') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% shows which routes match a given request and which don't and for what reason: php %command.full_name% /foo diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 9be88e427e6f9..ef5c0bbbe0f09 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -40,7 +40,7 @@ protected function configure() )) ->setName('server:run') ->setDescription('Runs PHP built-in web server') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% runs PHP built-in web server: %command.full_name% diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index 01678dd890f8a..04e62890b171e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -46,7 +46,7 @@ protected function configure() new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'), )) ->setDescription('Updates the translation file') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% command extract translation strings from templates of a given bundle or the app folder. It can display them or merge the new ones into the translation files. When new translation strings are found it can automatically add a prefix to the translation @@ -150,6 +150,8 @@ protected function execute(InputInterface $input, OutputInterface $output) return; } + $resultMessage = 'Translation files were successfully updated'; + // show compiled list of messages if (true === $input->getOption('dump-messages')) { $extractedMessagesCount = 0; @@ -204,12 +206,10 @@ protected function execute(InputInterface $input, OutputInterface $output) $writer->writeTranslations($operation->getResult(), $input->getOption('output-format'), array('path' => $bundleTransPath, 'default_locale' => $this->getContainer()->getParameter('kernel.default_locale'))); if (true === $input->getOption('dump-messages')) { - $resultMessage .= ' and translation files were updated.'; - } else { - $resultMessage = 'Translation files were successfully updated.'; + $resultMessage .= ' and translation files were updated'; } } - $io->success($resultMessage); + $io->success($resultMessage.'.'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index c09c8942d225b..87626a4daf178 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -191,7 +191,7 @@ protected function describeContainerDefinition(Definition $definition, array $op $output .= "\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no'); foreach ($definition->getAutowiringTypes() as $autowiringType) { - $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; + $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php index 502398bee7f28..b229c8e41c627 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php @@ -13,7 +13,6 @@ use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareTrait; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\StreamedResponse; @@ -25,7 +24,6 @@ use Symfony\Component\Form\Form; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Doctrine\Bundle\DoctrineBundle\Registry; /** diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php index 3c96761ba3a6c..4ab0d82ed120a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConsoleCommandPass.php @@ -37,8 +37,7 @@ public function process(ContainerBuilder $container) } $class = $container->getParameterBag()->resolveValue($definition->getClass()); - $r = new \ReflectionClass($class); - if (!$r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command')) { + if (!is_subclass_of($class, 'Symfony\\Component\\Console\\Command\\Command')) { throw new \InvalidArgumentException(sprintf('The service "%s" tagged "console.command" must be a subclass of "Symfony\\Component\\Console\\Command\\Command".', $id)); } $container->setAlias('console.command.'.strtolower(str_replace('\\', '_', $class)), $id); diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index a6c95874c34f2..3bc577377677b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -43,6 +43,14 @@ public function getConfigTreeBuilder() $rootNode = $treeBuilder->root('framework'); $rootNode + ->beforeNormalization() + ->ifTrue(function ($v) { return !isset($v['assets']) && isset($v['templating']); }) + ->then(function ($v) { + $v['assets'] = array(); + + return $v; + }) + ->end() ->children() ->scalarNode('secret')->end() ->scalarNode('http_method_override') @@ -62,6 +70,10 @@ public function getConfigTreeBuilder() } if (false !== strpos($v, '/')) { + if ('0.0.0.0/0' === $v) { + return false; + } + list($v, $mask) = explode('/', $v, 2); if (strcmp($mask, (int) $mask) || $mask < 1 || $mask > (false !== strpos($v, ':') ? 128 : 32)) { @@ -383,7 +395,12 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode) ->prototype('array') ->fixXmlConfig('base_url') ->children() - ->scalarNode('version')->defaultNull()->end() + ->scalarNode('version') + ->beforeNormalization() + ->ifTrue(function ($v) { return '' === $v; }) + ->then(function ($v) { return; }) + ->end() + ->end() ->scalarNode('version_format')->defaultNull()->end() ->scalarNode('base_path')->defaultValue('')->end() ->arrayNode('base_urls') @@ -436,12 +453,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode) ->info('validation configuration') ->canBeEnabled() ->children() - ->scalarNode('cache') - ->beforeNormalization() - // Can be removed in 3.0, once ApcCache support is dropped - ->ifString()->then(function ($v) { return 'apc' === $v ? 'validator.mapping.cache.apc' : $v; }) - ->end() - ->end() + ->scalarNode('cache')->end() ->booleanNode('enable_annotations')->defaultFalse()->end() ->arrayNode('static_method') ->defaultValue(array('loadValidatorMetadata')) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 5fb6b7ab40269..6909b15ae33d2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -38,6 +38,11 @@ class FrameworkExtension extends Extension private $translationConfigEnabled = false; private $sessionConfigEnabled = false; + /** + * @var string|null + */ + private $kernelRootHash; + /** * Responds to the app.config configuration parameter. * @@ -137,6 +142,8 @@ public function load(array $configs, ContainerBuilder $container) } if ($container->getParameter('kernel.debug')) { + $definition->replaceArgument(2, E_ALL & ~(E_COMPILE_ERROR | E_PARSE | E_ERROR | E_CORE_ERROR | E_RECOVERABLE_ERROR)); + $loader->load('debug.xml'); $definition = $container->findDefinition('http_kernel'); @@ -148,7 +155,7 @@ public function load(array $configs, ContainerBuilder $container) $container->setDefinition('debug.event_dispatcher.parent', $definition); $container->setAlias('event_dispatcher', 'debug.event_dispatcher'); } else { - $definition->replaceArgument(2, E_COMPILE_ERROR | E_PARSE | E_ERROR | E_CORE_ERROR); + $definition->replaceArgument(1, null); } $this->addClassesToCompile(array( @@ -540,11 +547,7 @@ private function registerTemplatingConfiguration(array $config, $ide, ContainerB 'Symfony\\Bundle\\FrameworkBundle\\Templating\\Loader\\FilesystemLoader', )); - if ($container->hasDefinition('assets.packages')) { - $container->getDefinition('templating.helper.assets')->replaceArgument(0, new Reference('assets.packages')); - } else { - $container->removeDefinition('templating.helper.assets'); - } + $container->getDefinition('templating.helper.assets')->replaceArgument(0, new Reference('assets.packages')); } } @@ -566,7 +569,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co $namedPackages = array(); foreach ($config['packages'] as $name => $package) { - if (null === $package['version']) { + if (!array_key_exists('version', $package)) { $version = $defaultVersion; } else { $format = $package['version_format'] ?: $config['version_format']; @@ -664,16 +667,17 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder $dirs[] = dirname($r->getFileName()).'/../Resources/translations'; } - $overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations'; + $rootDir = $container->getParameter('kernel.root_dir'); foreach ($container->getParameter('kernel.bundles') as $bundle => $class) { $reflection = new \ReflectionClass($class); if (is_dir($dir = dirname($reflection->getFileName()).'/Resources/translations')) { $dirs[] = $dir; } - if (is_dir($dir = sprintf($overridePath, $bundle))) { + if (is_dir($dir = $rootDir.sprintf('/Resources/%s/translations', $bundle))) { $dirs[] = $dir; } } + foreach ($config['paths'] as $dir) { if (is_dir($dir)) { $dirs[] = $dir; @@ -681,7 +685,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory', $dir)); } } - if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/translations')) { + + if (is_dir($dir = $rootDir.'/Resources/translations')) { $dirs[] = $dir; } @@ -763,7 +768,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder if (isset($config['cache'])) { $container->setParameter( 'validator.mapping.cache.prefix', - 'validator_'.hash('sha256', $container->getParameter('kernel.root_dir')) + 'validator_'.$this->getKernelRootHash($container) ); $validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache']))); @@ -939,7 +944,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder if (isset($config['cache']) && $config['cache']) { $container->setParameter( 'serializer.mapping.cache.prefix', - 'serializer_'.hash('sha256', $container->getParameter('kernel.root_dir')) + 'serializer_'.$this->getKernelRootHash($container) ); $container->getDefinition('serializer.mapping.class_metadata_factory')->replaceArgument( @@ -974,6 +979,22 @@ private function registerPropertyInfoConfiguration(array $config, ContainerBuild } } + /** + * Gets a hash of the kernel root directory. + * + * @param ContainerBuilder $container + * + * @return string + */ + private function getKernelRootHash(ContainerBuilder $container) + { + if (!$this->kernelRootHash) { + $this->kernelRootHash = hash('sha256', $container->getParameter('kernel.root_dir')); + } + + return $this->kernelRootHash; + } + /** * Returns the base path for the XSD files. * diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/meta/LICENSE b/src/Symfony/Bundle/FrameworkBundle/LICENSE similarity index 96% rename from src/Symfony/Bundle/FrameworkBundle/Resources/meta/LICENSE rename to src/Symfony/Bundle/FrameworkBundle/LICENSE index 43028bc600f26..12a74531e40a4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/meta/LICENSE +++ b/src/Symfony/Bundle/FrameworkBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Fabien Potencier +Copyright (c) 2004-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml index 5d743911198eb..edbd0d64b88e1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml @@ -48,6 +48,19 @@ + + + + + + + + + + + + + @@ -60,6 +73,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml index acb465be58924..1c27817239e17 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml @@ -29,7 +29,9 @@ - + + Symfony\Component\DependencyInjection\ContainerInterface + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml index 80148144cb65e..ba77ba93cbcb7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml @@ -34,8 +34,7 @@ - - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml index ac153f91b27a5..86b290eb297b2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml @@ -28,8 +28,14 @@ - - %validator.mapping.cache.prefix% + + + + + %validator.mapping.cache.prefix% + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/body.css b/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/body.css index 6b81755056337..c50c1a54c7868 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/body.css +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/body.css @@ -117,7 +117,7 @@ build: 56 background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR1JREFUeNpiPHnyZCMDA8MNID5gZmb2nAEJMH7//v3N169fX969e/cYkL8WqGAHXPLv37//QYzfv39/fvPmzbUnT56sAXInmJub/2H5/x8sx8DCwsIrISFhDmQyPX78+CmQXs70798/BmQsKipqBNTgdvz4cWkmkE5kDATMioqKZkCFdiwg1eiAi4tLGqhQF24nMmBmZuYEigth1QkEbEBxTlySYPvJkwSJ00AnjYylgU6gxB8g/oFVEphkvgLF32KNMmCCewYUv4qhEyj47+HDhyeBzIMYOoEp8CxQw56wsLAncJ1//vz5/P79+2svX74EJc2V4BT58+fPd8CE/QKYHMGJOiIiAp6oWW7evDkNSF8DZYfIyEiU7AAQYACJ2vxVdJW4eQAAAABJRU5ErkJggg==) right top no-repeat; } .sf-button .btn-bg { - padding: 0px 14px; + padding: 0 14px; color: #636363; line-height: 28px; background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAYAAACgXdXMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAClJREFUeNpiPnny5EKGf//+/Wf6//8/A4QAcrGzKCZwGc9sa2urBBBgAIbDUoYVp9lmAAAAAElFTkSuQmCC) repeat-x top left; diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css b/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css index 7426d44f885d4..10480b0757c9f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css @@ -7,7 +7,6 @@ padding: 5px 4px; list-style-type: decimal; margin-left: 20px; - white-space: break-word; } .sf-reset #logs .traces li.error { font-style: normal; diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/AssetsHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/AssetsHelper.php new file mode 100644 index 0000000000000..072b6e7fc9302 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/AssetsHelper.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Templating\Helper; + +use Symfony\Component\Asset\Packages; +use Symfony\Component\Templating\Helper\Helper; + +/** + * AssetsHelper helps manage asset URLs. + * + * @author Fabien Potencier + */ +class AssetsHelper extends Helper +{ + private $packages; + + public function __construct(Packages $packages) + { + $this->packages = $packages; + } + + /** + * Returns the public url/path of an asset. + * + * If the package used to generate the path is an instance of + * UrlPackage, you will always get a URL and not a path. + * + * @param string $path A public path + * @param string $packageName The name of the asset package to use + * + * @return string The public path of the asset + */ + public function getUrl($path, $packageName = null) + { + return $this->packages->getUrl($path, $packageName); + } + + /** + * Returns the version of an asset. + * + * @param string $path A public path + * @param string $packageName The name of the asset package to use + * + * @return string The asset version + */ + public function getVersion($path, $packageName = null) + { + return $this->packages->getVersion($path, $packageName); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'assets'; + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php index e4a7053d25719..92fb94419d5af 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php @@ -55,7 +55,7 @@ public function parse($name) throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name)); } - if (!preg_match('/^([^:]*):([^:]*):(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) { + if (!preg_match('/^(?:([^:]*):)?(?:([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) { return parent::parse($name); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php index aa8b66929c7ce..7f8de034f94b9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php @@ -80,10 +80,14 @@ private static function getPhpUnitCliConfigArgument() if (preg_match('/^-[^ \-]*c$/', $testArg) || $testArg === '--configuration') { $dir = realpath($reversedArgs[$argIndex - 1]); break; - } elseif (strpos($testArg, '--configuration=') === 0) { + } elseif (0 === strpos($testArg, '--configuration=')) { $argPath = substr($testArg, strlen('--configuration=')); $dir = realpath($argPath); break; + } elseif (0 === strpos($testArg, '-c')) { + $argPath = substr($testArg, strlen('-c')); + $dir = realpath($argPath); + break; } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php index 9830897914a3f..44e3b5d113020 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php @@ -81,5 +81,6 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup() } } $this->assertTrue($found, 'Kernel file should present as resource'); + $this->assertRegExp(sprintf('/\'kernel.name\'\s*=>\s*\'%s\'/', $this->kernel->getName()), file_get_contents($containerFile), 'kernel.name is properly set on the dumped container'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php index a04a0cccad77c..f7eca9d366d38 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php @@ -28,6 +28,14 @@ public function testDumpMessagesAndClean() $tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo'))); $tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true)); $this->assertRegExp('/foo/', $tester->getDisplay()); + $this->assertRegExp('/2 messages were successfully extracted/', $tester->getDisplay()); + } + + public function testWriteMessages() + { + $tester = $this->createCommandTester($this->getContainer(array('foo' => 'foo'))); + $tester->execute(array('command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--force' => true)); + $this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay()); } protected function setUp() diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php index 3d41fb12b09e5..74f0b607bda3e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php @@ -53,7 +53,7 @@ public function testReturningEmptyArrayWhenNoService() { $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder', array('findTaggedServiceIds')); - $container->expects($this->any()) + $container->expects($this->any()) ->method('findTaggedServiceIds') ->will($this->returnValue(array())); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index d0dba2badf4f7..1655d7d0ea382 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -66,6 +66,7 @@ public function getTestValidTrustedProxiesData() array(array(), array()), array(array('10.0.0.0/8'), array('10.0.0.0/8')), array(array('::ffff:0:0/96'), array('::ffff:0:0/96')), + array(array('0.0.0.0/0'), array('0.0.0.0/0')), ); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php index e3532a7747cc6..1055251004bd9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php @@ -20,6 +20,10 @@ 'bar' => array( 'base_urls' => array('https://bar2.example.com'), ), + 'bar_null_version' => array( + 'version' => null, + 'base_urls' => array('https://bar3.example.com'), + ), ), ), )); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets_disabled.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets_disabled.php deleted file mode 100644 index bf12a8bc47e5f..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets_disabled.php +++ /dev/null @@ -1,7 +0,0 @@ -loadFromExtension('framework', array( - 'templating' => array( - 'engines' => array('php', 'twig'), - ), -)); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php index b6780cfa54ce2..deac8fa4ca022 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -56,7 +56,7 @@ ), 'validation' => array( 'enabled' => true, - 'cache' => 'apc', + 'cache' => 'validator.mapping.cache.doctrine.apc', ), 'annotations' => array( 'cache' => 'file', diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml index e39e15f900528..3e057d5b90254 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml @@ -18,6 +18,9 @@ https://bar2.example.com + + https://bar3.example.com + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets_disabled.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets_disabled.xml deleted file mode 100644 index d579ed4c0a181..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets_disabled.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - php - twig - - - diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index a7a42d0605c52..bc7535f209962 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -38,7 +38,7 @@ %kernel.root_dir%/Fixtures/translations - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml index 193dc59dfba3a..d3285ff58102c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml @@ -14,3 +14,6 @@ framework: version_format: %%s-%%s bar: base_urls: ["https://bar2.example.com"] + bar_null_version: + version: null + base_urls: "https://bar3.example.com" diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets_disabled.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets_disabled.yml deleted file mode 100644 index 66ffdf7adc797..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets_disabled.yml +++ /dev/null @@ -1,3 +0,0 @@ -framework: - templating: - engines: [php, twig] diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index 572c5beac34ca..1c49d145f1c14 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -44,7 +44,7 @@ framework: paths: ['%kernel.root_dir%/Fixtures/translations'] validation: enabled: true - cache: apc + cache: validator.mapping.cache.doctrine.apc annotations: cache: file debug: true diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 59bdbca6312c3..e655b52654d2c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -18,10 +18,11 @@ use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Validator\Validation; abstract class FrameworkExtensionTest extends TestCase { + private static $containerCache = array(); + abstract protected function loadFromFile(ContainerBuilder $container, $file); public function testFormCsrfProtection() @@ -208,7 +209,7 @@ public function testAssets() // packages $packages = $packages->getArgument(1); - $this->assertCount(4, $packages); + $this->assertCount(5, $packages); $package = $container->getDefinition($packages['images_path']); $this->assertPathPackage($container, $package, '/foo', 'SomeVersionScheme', '%%s?version=%%s'); @@ -298,7 +299,7 @@ public function testValidation() $this->assertSame('addMethodMapping', $calls[4][0]); $this->assertSame(array('loadValidatorMetadata'), $calls[4][1]); $this->assertSame('setMetadataCache', $calls[5][0]); - $this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]); + $this->assertEquals(array(new Reference('validator.mapping.cache.doctrine.apc')), $calls[5][1]); } public function testValidationService() @@ -437,7 +438,15 @@ public function testAssetHelperWhenAssetsAreEnabled() public function testAssetHelperWhenTemplatesAreEnabledAndAssetsAreDisabled() { - $container = $this->createContainerFromFile('assets_disabled'); + $container = $this->createContainerFromFile('full'); + $packages = $container->getDefinition('templating.helper.assets')->getArgument(0); + + $this->assertSame('assets.packages', (string) $packages); + } + + public function testAssetHelperWhenAssetsAndTemplatesAreDisabled() + { + $container = $this->createContainerFromFile('default_config'); $this->assertFalse($container->hasDefinition('templating.helper.assets')); } @@ -482,6 +491,10 @@ protected function createContainer(array $data = array()) protected function createContainerFromFile($file, $data = array()) { + $cacheKey = md5(get_class($this).$file.serialize($data)); + if (isset(self::$containerCache[$cacheKey])) { + return self::$containerCache[$cacheKey]; + } $container = $this->createContainer($data); $container->registerExtension(new FrameworkExtension()); $this->loadFromFile($container, $file); @@ -490,7 +503,7 @@ protected function createContainerFromFile($file, $data = array()) $container->getCompilerPassConfig()->setRemovingPasses(array()); $container->compile(); - return $container; + return self::$containerCache[$cacheKey] = $container; } protected function createContainerFromClosure($closure, $data = array()) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php index 01c73930db8b1..b077e80dc43e3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php @@ -28,7 +28,7 @@ protected function loadFromFile(ContainerBuilder $container, $file) */ public function testAssetsCannotHavePathAndUrl() { - $container = $this->createContainerFromClosure(function ($container) { + $this->createContainerFromClosure(function ($container) { $container->loadFromExtension('framework', array( 'assets' => array( 'base_urls' => 'http://cdn.example.com', @@ -43,7 +43,7 @@ public function testAssetsCannotHavePathAndUrl() */ public function testAssetPackageCannotHavePathAndUrl() { - $container = $this->createContainerFromClosure(function ($container) { + $this->createContainerFromClosure(function ($container) { $container->loadFromExtension('framework', array( 'assets' => array( 'packages' => array( diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php index e7f170d075ddf..38ce8d3990514 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/DependencyInjection/TestExtension.php @@ -12,7 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; class TestExtension extends Extension implements PrependExtensionInterface diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Resources/fragment.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Resources/views/fragment.html.php similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Resources/fragment.html.php rename to src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Resources/views/fragment.html.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php new file mode 100644 index 0000000000000..7e9a25313cd29 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/AssetsHelperTest.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper; + +use Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper; +use Symfony\Component\Asset\Package; +use Symfony\Component\Asset\Packages; +use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy; + +class AssetsHelperTest extends \PHPUnit_Framework_TestCase +{ + private $helper; + + protected function setUp() + { + $fooPackage = new Package(new StaticVersionStrategy('42', '%s?v=%s')); + $barPackage = new Package(new StaticVersionStrategy('22', '%s?%s')); + + $packages = new Packages($fooPackage, ['bar' => $barPackage]); + + $this->helper = new AssetsHelper($packages); + } + + public function testGetUrl() + { + $this->assertEquals('me.png?v=42', $this->helper->getUrl('me.png')); + $this->assertEquals('me.png?22', $this->helper->getUrl('me.png', 'bar')); + } + + public function testGetVersion() + { + $this->assertEquals('42', $this->helper->getVersion('/')); + $this->assertEquals('22', $this->helper->getVersion('/', 'bar')); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php index ca10c3a8fe861..4ff824bf7ca82 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php @@ -43,30 +43,33 @@ protected function tearDown() } /** - * @dataProvider getLogicalNameToTemplateProvider + * @dataProvider parseProvider */ - public function testParse($name, $ref) + public function testParse($name, $logicalName, $path, $ref) { $template = $this->parser->parse($name); - $this->assertEquals($template->getLogicalName(), $ref->getLogicalName()); - $this->assertEquals($template->getLogicalName(), $name); + $this->assertSame($ref->getLogicalName(), $template->getLogicalName()); + $this->assertSame($logicalName, $template->getLogicalName()); + $this->assertSame($path, $template->getPath()); } - public function getLogicalNameToTemplateProvider() + public function parseProvider() { return array( - array('FooBundle:Post:index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')), - array('FooBundle:Post:index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')), - array('FooBundle:Post:index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')), - array('SensioFooBundle:Post:index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')), - array('SensioCmsFooBundle:Post:index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')), - array(':Post:index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')), - array('::index.html.php', new TemplateReference('', '', 'index', 'html', 'php')), - array('FooBundle:Post:foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')), - array('/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')), - array('name.twig', new BaseTemplateReference('name.twig', 'twig')), - array('name', new BaseTemplateReference('name')), + array('FooBundle:Post:index.html.php', 'FooBundle:Post:index.html.php', '@FooBundle/Resources/views/Post/index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')), + array('FooBundle:Post:index.html.twig', 'FooBundle:Post:index.html.twig', '@FooBundle/Resources/views/Post/index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')), + array('FooBundle:Post:index.xml.php', 'FooBundle:Post:index.xml.php', '@FooBundle/Resources/views/Post/index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')), + array('SensioFooBundle:Post:index.html.php', 'SensioFooBundle:Post:index.html.php', '@SensioFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')), + array('SensioCmsFooBundle:Post:index.html.php', 'SensioCmsFooBundle:Post:index.html.php', '@SensioCmsFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')), + array(':Post:index.html.php', ':Post:index.html.php', 'views/Post/index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')), + array('::index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')), + array('index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')), + array('FooBundle:Post:foo.bar.index.html.php', 'FooBundle:Post:foo.bar.index.html.php', '@FooBundle/Resources/views/Post/foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')), + array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')), + array('name.twig', 'name.twig', 'name.twig', new BaseTemplateReference('name.twig', 'twig')), + array('name', 'name', 'name', new BaseTemplateReference('name')), + array('default/index.html.php', '::default/index.html.php', 'views/default/index.html.php', new TemplateReference(null, null, 'default/index', 'html', 'php')), ); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php index 21406feb49a5f..ca9e7f994c090 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -60,6 +60,11 @@ public function extract($resource, MessageCatalogue $catalog) $files = $this->extractFiles($resource); foreach ($files as $file) { $this->parseTokens(token_get_all(file_get_contents($file)), $catalog); + + if (PHP_VERSION_ID >= 70000) { + // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098 + gc_mem_caches(); + } } } @@ -80,7 +85,7 @@ public function setPrefix($prefix) */ protected function normalizeToken($token) { - if (is_array($token)) { + if (isset($token[1]) && 'b"' !== $token) { return $token[1]; } @@ -94,7 +99,7 @@ private function seekToNextRelevantToken(\Iterator $tokenIterator) { for (; $tokenIterator->valid(); $tokenIterator->next()) { $t = $tokenIterator->current(); - if (!is_array($t) || ($t[0] !== T_WHITESPACE)) { + if (T_WHITESPACE !== $t[0]) { break; } } @@ -111,7 +116,7 @@ private function getMessage(\Iterator $tokenIterator) for (; $tokenIterator->valid(); $tokenIterator->next()) { $t = $tokenIterator->current(); - if (!is_array($t)) { + if (!isset($t[1])) { break; } diff --git a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php index 14271dc459a08..e12859661298b 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/InitAclCommand.php @@ -43,7 +43,7 @@ protected function configure() $this ->setName('init:acl') ->setDescription('Mounts ACL tables in the database') - ->setHelp(<<setHelp(<<<'EOF' The %command.name% command mounts ACL tables in the database. php %command.full_name% diff --git a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php index 7b3e111974ea5..0fff7552e858d 100644 --- a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php +++ b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php @@ -89,7 +89,7 @@ public function collect(Request $request, Response $response, \Exception $except if (null !== $this->logoutUrlGenerator) { $logoutUrl = $this->logoutUrlGenerator->getLogoutPath(); } - } catch(\Exception $e) { + } catch (\Exception $e) { // fail silently when the logout URL cannot be generated } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.php index ae9322f229c21..a360504572656 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.php @@ -29,6 +29,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider, $container ->setDefinition($provider, new DefinitionDecorator('security.authentication.provider.dao')) ->replaceArgument(0, new Reference($userProvider)) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) ->replaceArgument(2, $id) ; diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php index 068cda6a1fe81..8aea9074bd71a 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php @@ -52,7 +52,7 @@ public function addConfiguration(NodeDefinition $node) ->scalarNode('search_dn')->end() ->scalarNode('search_password')->end() ->arrayNode('default_roles') - ->beforeNormalization()->ifString()->then(function($v) { return preg_split('/\s*,\s*/', $v); })->end() + ->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end() ->requiresAtLeastOneElement() ->prototype('scalar')->end() ->end() diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index ac052111b6c9d..6043ed6292089 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -14,14 +14,12 @@ use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; -use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\Config\FileLocator; use Symfony\Component\Security\Core\Authorization\ExpressionLanguage; diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/meta/LICENSE b/src/Symfony/Bundle/SecurityBundle/LICENSE similarity index 96% rename from src/Symfony/Bundle/SecurityBundle/Resources/meta/LICENSE rename to src/Symfony/Bundle/SecurityBundle/LICENSE index 43028bc600f26..12a74531e40a4 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/meta/LICENSE +++ b/src/Symfony/Bundle/SecurityBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Fabien Potencier +Copyright (c) 2004-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index c6aef2b99c5fa..af293a7b633ff 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -18,6 +18,8 @@ abstract class CompleteConfigurationTest extends \PHPUnit_Framework_TestCase { + private static $containerCache = array(); + abstract protected function loadFromFile(ContainerBuilder $container, $file); public function testRolesHierarchy() @@ -255,6 +257,9 @@ public function testUserCheckerConfigWithNoCheckers() protected function getContainer($file) { + if (isset(self::$containerCache[$file])) { + return self::$containerCache[$file]; + } $container = new ContainerBuilder(); $security = new SecurityExtension(); $container->registerExtension($security); @@ -267,6 +272,6 @@ protected function getContainer($file) $container->getCompilerPassConfig()->setRemovingPasses(array()); $container->compile(); - return $container; + return self::$containerCache[$file] = $container; } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php index 90b6b3e5eb238..dfedac3735f53 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php @@ -13,8 +13,8 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; class FirewallEntryPointExtension extends Extension { diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/DependencyInjection/FormLoginExtension.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/DependencyInjection/FormLoginExtension.php index 4bdd3e8266e83..6d5715931e1fa 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/DependencyInjection/FormLoginExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/DependencyInjection/FormLoginExtension.php @@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Extension\Extension; class FormLoginExtension extends Extension { diff --git a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php index 36e4f059ff812..b6cbb6be7a29b 100644 --- a/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php +++ b/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php @@ -43,7 +43,7 @@ protected function configure() $this ->setHelp( - $this->getHelp().<<getHelp().<<<'EOF' Or all template files in a bundle: diff --git a/src/Symfony/Bundle/TwigBundle/Resources/meta/LICENSE b/src/Symfony/Bundle/TwigBundle/LICENSE similarity index 96% rename from src/Symfony/Bundle/TwigBundle/Resources/meta/LICENSE rename to src/Symfony/Bundle/TwigBundle/LICENSE index 43028bc600f26..12a74531e40a4 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/meta/LICENSE +++ b/src/Symfony/Bundle/TwigBundle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2015 Fabien Potencier +Copyright (c) 2004-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml index bd1635ed87501..55182c083abd5 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml @@ -112,6 +112,7 @@ + diff --git a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig index 947df655836b8..72dea08ea21d7 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig +++ b/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig @@ -98,7 +98,7 @@ if (clazz) { var tags = document.getElementsByTagName('*'); - for (i = tags.length - 1; i >= 0 ; i--) { + for (i = tags.length - 1; i >= 0; i--) { if (tags[i].className === clazz) { tags[i].style.display = 'none'; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index a5590c17df8b5..ba8a94633282a 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -286,7 +286,6 @@ public function searchResultsAction(Request $request, $token) 'end' => $end, 'limit' => $limit, 'panel' => null, - 'request' => $request, )), 200, array('Content-Type' => 'text/html')); } @@ -332,7 +331,6 @@ public function searchAction(Request $request) $tokens = $this->profiler->find($ip, $url, $limit, $method, $start, $end); return new RedirectResponse($this->generator->generate('_profiler_search_results', array( - 'request' => $request, 'token' => $tokens ? $tokens[0]['token'] : 'empty', 'ip' => $ip, 'method' => $method, diff --git a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php index 724fe5503b3b8..8af7c63e64aaa 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php +++ b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; diff --git a/src/Symfony/Bundle/WebProfilerBundle/LICENSE b/src/Symfony/Bundle/WebProfilerBundle/LICENSE new file mode 100644 index 0000000000000..12a74531e40a4 --- /dev/null +++ b/src/Symfony/Bundle/WebProfilerBundle/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2016 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/meta/LICENSE b/src/Symfony/Bundle/WebProfilerBundle/Resources/meta/LICENSE deleted file mode 100644 index 43028bc600f26..0000000000000 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/meta/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-2015 Fabien Potencier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig index 8d5eaf7e1ac46..197cc010d2e40 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig @@ -14,7 +14,6 @@ padding: 5px 0; list-style-type: decimal; margin: 0 0 0 1em; - white-space: break-word; } .sf-reset .traces li.selected { background: rgba(255, 255, 153, 0.5); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig index 07dd6bb23e777..488974f7d4d25 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig @@ -97,10 +97,6 @@ /* provide a bigger clickable area than just 10x10px */ width: 16px; height: 16px; - /* vertically center the button */ - position: absolute; - top: 50%; - margin-top: -8px; margin-left: -18px; } .tree .toggle-icon { @@ -110,7 +106,7 @@ margin-left: 3px; margin-top: 3px; background-size: 10px 20px; - background-color: #ccc; + background-color: #AAA; } .tree .toggle-icon.empty { width: 10px; @@ -437,7 +433,7 @@
{% endif %} - {{ name|default('(no name)') }} {% if data.type_class is defined and data.type is defined %}[{{ data.type }}]{% endif %} + {{ name|default('(no name)') }} {% if data.type_class is defined %}[{{ data.type_class|split('\\')|last }}]{% endif %} {% if data.errors is defined and data.errors|length > 0 %}
{{ data.errors|length }}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig index 6f819e4275890..c25a5c54d6cd2 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig @@ -184,7 +184,7 @@ {% for index, call in stack if index > 1 %} {% if index == 2 %} -
    +