From 7bbd56892dab4310ef1238f5bd815beb08f4bac0 Mon Sep 17 00:00:00 2001 From: FlorianLB Date: Wed, 1 Jan 2014 14:36:01 +0100 Subject: [PATCH 01/12] [Routing] add missing unit tests for Route and RouteCollection classes --- .../Routing/Tests/RouteCollectionTest.php | 43 +++++++++++++++++++ .../Component/Routing/Tests/RouteTest.php | 33 +++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php b/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php index 3d78adf923..321ed64b92 100644 --- a/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteCollectionTest.php @@ -252,4 +252,47 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('{locale}.example.com', $routea->getHost()); $this->assertEquals('{locale}.example.com', $routeb->getHost()); } + + public function testClone() + { + $collection = new RouteCollection(); + $collection->add('a', new Route('/a')); + $collection->add('b', new Route('/b', array('placeholder' => 'default'), array('placeholder' => '.+'))); + + $clonedCollection = clone $collection; + + $this->assertCount(2, $clonedCollection); + $this->assertEquals($collection->get('a'), $clonedCollection->get('a')); + $this->assertNotSame($collection->get('a'), $clonedCollection->get('a')); + $this->assertEquals($collection->get('b'), $clonedCollection->get('b')); + $this->assertNotSame($collection->get('b'), $clonedCollection->get('b')); + } + + public function testSetSchemes() + { + $collection = new RouteCollection(); + $routea = new Route('/a', array(), array(), array(), '', 'http'); + $routeb = new Route('/b'); + $collection->add('a', $routea); + $collection->add('b', $routeb); + + $collection->setSchemes(array('http', 'https')); + + $this->assertEquals(array('http', 'https'), $routea->getSchemes()); + $this->assertEquals(array('http', 'https'), $routeb->getSchemes()); + } + + public function testSetMethods() + { + $collection = new RouteCollection(); + $routea = new Route('/a', array(), array(), array(), '', array(), array('GET', 'POST')); + $routeb = new Route('/b'); + $collection->add('a', $routea); + $collection->add('b', $routeb); + + $collection->setMethods('PUT'); + + $this->assertEquals(array('PUT'), $routea->getMethods()); + $this->assertEquals(array('PUT'), $routeb->getMethods()); + } } diff --git a/src/Symfony/Component/Routing/Tests/RouteTest.php b/src/Symfony/Component/Routing/Tests/RouteTest.php index e4046fafd5..c562af8ec2 100644 --- a/src/Symfony/Component/Routing/Tests/RouteTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteTest.php @@ -62,6 +62,15 @@ class RouteTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('foo' => 'foo', 'bar' => 'bar', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'), $route->getOptions(), '->addDefaults() keep previous defaults'); } + public function testOption() + { + $route = new Route('/{foo}'); + $this->assertFalse($route->hasOption('foo'), '->hasOption() return false if option is not set'); + $this->assertEquals($route, $route->setOption('foo', 'bar'), '->setOption() implements a fluent interface'); + $this->assertEquals('bar', $route->getOption('foo'), '->setOption() sets the option'); + $this->assertTrue($route->hasOption('foo'), '->hasOption() return true if option is set'); + } + public function testDefaults() { $route = new Route('/{foo}'); @@ -74,7 +83,7 @@ class RouteTest extends \PHPUnit_Framework_TestCase $route->setDefault('foo2', 'bar2'); $this->assertEquals('bar2', $route->getDefault('foo2'), '->getDefault() return the default value'); - $this->assertNull($route->getDefault('not_defined'), '->getDefault() return null if default value is not setted'); + $this->assertNull($route->getDefault('not_defined'), '->getDefault() return null if default value is not set'); $route->setDefault('_controller', $closure = function () { return 'Hello'; }); $this->assertEquals($closure, $route->getDefault('_controller'), '->setDefault() sets a default value'); @@ -105,8 +114,10 @@ class RouteTest extends \PHPUnit_Framework_TestCase public function testRequirement() { $route = new Route('/{foo}'); + $this->assertFalse($route->hasRequirement('foo'), '->hasRequirement() return false if requirement is not set'); $route->setRequirement('foo', '^\d+$'); $this->assertEquals('\d+', $route->getRequirement('foo'), '->setRequirement() removes ^ and $ from the path'); + $this->assertTrue($route->hasRequirement('foo'), '->hasRequirement() return true if requirement is set'); } /** @@ -197,4 +208,24 @@ class RouteTest extends \PHPUnit_Framework_TestCase $route->setRequirement('foo', '.*'); $this->assertNotSame($compiled, $route->compile(), '->compile() recompiles if the route was modified'); } + + public function testPattern() + { + $route = new Route('/{foo}'); + $this->assertEquals('/{foo}', $route->getPattern()); + + $route->setPattern('/bar'); + $this->assertEquals('/bar', $route->getPattern()); + } + + public function testSerialize() + { + $route = new Route('/{foo}', array('foo' => 'default'), array('foo' => '\d+')); + + $serialized = serialize($route); + $unserialized = unserialize($serialized); + + $this->assertEquals($route, $unserialized); + $this->assertNotSame($route, $unserialized); + } } From 1b798319f675d543d3a9d7af6a8eb4a9742b5024 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 2 Jan 2014 10:24:22 +0000 Subject: [PATCH 02/12] [HttpFoundation] Documented public properties. --- src/Symfony/Component/HttpFoundation/Request.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 02a3d9dcb9..685772b250 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -64,6 +64,8 @@ class Request protected static $httpMethodParameterOverride = false; /** + * Custom parameters + * * @var \Symfony\Component\HttpFoundation\ParameterBag * * @api @@ -71,6 +73,8 @@ class Request public $attributes; /** + * Request body parameters ($_POST) + * * @var \Symfony\Component\HttpFoundation\ParameterBag * * @api @@ -78,6 +82,8 @@ class Request public $request; /** + * Query string parameters ($_GET) + * * @var \Symfony\Component\HttpFoundation\ParameterBag * * @api @@ -85,6 +91,8 @@ class Request public $query; /** + * Server and execution environment parameters ($_SERVER) + * * @var \Symfony\Component\HttpFoundation\ServerBag * * @api @@ -92,6 +100,8 @@ class Request public $server; /** + * Uploaded files ($_FILES) + * * @var \Symfony\Component\HttpFoundation\FileBag * * @api @@ -99,6 +109,8 @@ class Request public $files; /** + * Cookies ($_COOKIE) + * * @var \Symfony\Component\HttpFoundation\ParameterBag * * @api @@ -106,6 +118,8 @@ class Request public $cookies; /** + * Headers (taken from the $_SERVER) + * * @var \Symfony\Component\HttpFoundation\HeaderBag * * @api From 11c8b8d46cab823fd410686b9dab9afc9fce0e8f Mon Sep 17 00:00:00 2001 From: Mathieu Lemoine Date: Sat, 4 Jan 2014 16:42:51 -0500 Subject: [PATCH 03/12] Fix hardcoded listenerTag name in error message --- .../HttpKernel/DependencyInjection/RegisterListenersPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php index 543049ddce..6c56634216 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php @@ -70,7 +70,7 @@ class RegisterListenersPass implements CompilerPassInterface $priority = isset($event['priority']) ? $event['priority'] : 0; if (!isset($event['event'])) { - throw new \InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); + throw new \InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "%s" tags.', $id, $this->listenerTag)); } if (!isset($event['method'])) { From 3065f243adedfff507fb2754f62debb3f215cd47 Mon Sep 17 00:00:00 2001 From: Peter Gribanov Date: Fri, 3 Jan 2014 18:45:57 +0300 Subject: [PATCH 04/12] Add support SAPI cli-server --- src/Symfony/Component/Process/PhpExecutableFinder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Process/PhpExecutableFinder.php b/src/Symfony/Component/Process/PhpExecutableFinder.php index 9d5307e193..9001f41095 100644 --- a/src/Symfony/Component/Process/PhpExecutableFinder.php +++ b/src/Symfony/Component/Process/PhpExecutableFinder.php @@ -39,7 +39,7 @@ class PhpExecutableFinder } // PHP_BINARY return the current sapi executable - if (defined('PHP_BINARY') && PHP_BINARY && ('cli' === PHP_SAPI) && is_file(PHP_BINARY)) { + if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server')) && is_file(PHP_BINARY)) { return PHP_BINARY; } From 08bd497e7d5c64de44db2df6faceb7e668484234 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 5 Jan 2014 02:23:55 +0100 Subject: [PATCH 05/12] updated CHANGELOG for 2.3.9 --- CHANGELOG-2.3.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md index 1ea4d10300..66d6819fbe 100644 --- a/CHANGELOG-2.3.md +++ b/CHANGELOG-2.3.md @@ -7,6 +7,39 @@ in 2.3 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1 +* 2.3.9 (2014-01-05) + + * bug #9938 [Process] Add support SAPI cli-server (peter-gribanov) + * bug #9940 [EventDispatcher] Fix hardcoded listenerTag name in error message (lemoinem) + * bug #9908 [HttpFoundation] Throw proper exception when invalid data is passed to JsonResponse class (stloyd) + * bug #9902 [Security] fixed pre/post authentication checks (fabpot) + * bug #9899 [Filesystem | WCM] 9339 fix stat on url for filesystem copy (cordoval) + * bug #9589 [DependencyInjection] Fixed #9020 - Added support for collections in service#parameters (lavoiesl) + * bug #9889 [Console] fixed column width when using the Table helper with some decoration in cells (fabpot) + * bug #9323 [DomCrawler]fix #9321 Crawler::addHtmlContent add gbk encoding support (bronze1man) + * bug #8997 [Security] Fixed problem with losing ROLE_PREVIOUS_ADMIN role. (pawaclawczyk) + * bug #9557 [DoctrineBridge] Fix for cache-key conflict when having a \Traversable as choices (DRvanR) + * bug #9879 [Security] Fix ExceptionListener to catch correctly AccessDeniedException if is not first exception (fabpot) + * bug #9885 [Dependencyinjection] Fixed handling of inlined references in the AnalyzeServiceReferencesPass (fabpot) + * bug #9884 [DomCrawler] Fixed creating form objects from named form nodes (jakzal) + * bug #9882 Add support for HHVM in the getting of the PHP executable (fabpot) + * bug #9850 [Validator] Fixed IBAN validator with 0750447346 value (stewe) + * bug #9865 [Validator] Fixes message value for objects (jongotlin) + * bug #9441 [Form][DateTimeToArrayTransformer] Check for hour, minute & second validity (egeloen) + * bug #9867 #9866 [Filesystem] Fixed mirror for symlinks (COil) + * bug #9806 [Security] Fix parent serialization of user object (ddeboer) + * bug #9834 [DependencyInjection] Fixed support for backslashes in service ids. (jakzal) + * bug #9826 fix #9356 [Security] Logger should manipulate the user reloaded from provider (matthieuauger) + * bug #9769 [BrowserKit] fixes #8311 CookieJar is totally ignorant of RFC 6265 edge cases (jzawadzki) + * bug #9697 [Config] fix 5528 let ArrayNode::normalizeValue respect order of value array provided (cordoval) + * bug #9701 [Config] fix #7243 allow 0 as arraynode name (cordoval) + * bug #9795 [Form] Fixed issue in BaseDateTimeTransformer when invalid timezone cause Trans... (tyomo4ka) + * bug #9714 [HttpFoundation] BinaryFileResponse should also return 416 or 200 on some range-requets (SimonSimCity) + * bug #9601 [Routing] Remove usage of deprecated _scheme requirement (Danez) + * bug #9489 [DependencyInjection] Add normalization to tag options (WouterJ) + * bug #9135 [Form] [Validator] fix maxLength guesser (franek) + * bug #9790 [Filesystem] Changed the mode for a target file in copy() to be write only (jakzal) + * 2.3.8 (2013-12-16) * bug #9758 [Console] fixed TableHelper when cell value has new line (k-przybyszewski) From e9356832fdf391af0e5af897044233bf0b713c52 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 5 Jan 2014 02:24:39 +0100 Subject: [PATCH 06/12] update CONTRIBUTORS for 2.3.9 --- CONTRIBUTORS.md | 85 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index a14c40aaa2..57374a576a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,8 +16,8 @@ Symfony2 is the result of the work of many people who made the code better - Karma Dordrak (drak) - Ryan Weaver (weaverryan) - Lukas Kahwe Smith (lsmith) - - Joseph Bielawski (stloyd) - Jakub Zalas (jakubzalas) + - Joseph Bielawski (stloyd) - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) @@ -37,10 +37,10 @@ Symfony2 is the result of the work of many people who made the code better - Miha Vrhovnik - Henrik Bjørnskov (henrikbjorn) - Konstantin Kudryashov (everzet) - - Florin Patan (florinpatan) - Bilal Amarni (bamarni) - - Saša Stamenković (umpirsky) + - Florin Patan (florinpatan) - Grégoire Pineau (lyrixx) + - Saša Stamenković (umpirsky) - hhamon - Eric Clemmons (ericclemmons) - Deni @@ -48,6 +48,7 @@ Symfony2 is the result of the work of many people who made the code better - Dariusz Górecki (canni) - Arnout Boks (aboks) - Andrej Hudec (pulzarraider) + - Wouter De Jong (wouterj) - Lee McDermott - Brandon Turner - Daniel Holmes (dholmes) @@ -56,46 +57,48 @@ Symfony2 is the result of the work of many people who made the code better - John Wards (johnwards) - Fran Moreno (franmomu) - Bart van den Burg (burgov) + - Christian Raue - Antoine Hérault (herzult) - Toni Uebernickel (havvg) - - Christian Raue - Michel Weimerskirch (mweimerskirch) + - Brice BERNARD (brikou) - Arnaud Le Blanc (arnaud-lb) - marc.weistroff - - Brice BERNARD (brikou) - lenar - Tim Nagel (merk) - Włodzimierz Gajda (gajdaw) + - Kevin Bond (kbond) - Colin Frei - excelwebzone - - Wouter De Jong (wouterj) - - Kevin Bond (kbond) - Fabien Pennequin (fabienpennequin) - Jacob Dreesen (jdreesen) - Adrien Brault (adrienbrault) - Michal Piotrowski (eventhorizon) + - Luis Cordova (cordoval) - Robert Schönthal (digitalkaoz) - Juti Noppornpitak (shiroyuki) - Sebastian Hörl (blogsh) - Hidenori Goto (hidenorigoto) - Gábor Egyed (1ed) - David Buchmann (dbu) + - Ait Boudad Abdellatif (aitboudad) - Daniel Gomes (danielcsgomes) - Peter Kokot (maastermedia) - Jérémie Augustin (jaugustin) - Tigran Azatyan (tigranazatyan) + - Javier Eguiluz (javier.eguiluz) - Rafael Dohms (rdohms) - Richard Shank (iampersistent) - Gordon Franke (gimler) - Helmer Aaviksoo - - Javier Eguiluz (javier.eguiluz) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba - - Ait Boudad Abdellatif (aitboudad) - Pablo Godel (pgodel) + - Eric GELOEN (gelo) + - Jérôme Tamarelle (gromnan) - Sebastiaan Stok (sstok) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) @@ -105,11 +108,10 @@ Symfony2 is the result of the work of many people who made the code better - Arnaud Kleinpeter (nanocom) - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) - - Eric GELOEN (gelo) - Benjamin Dulau (dbenjamin) - Andreas Hucks (meandmymonkey) - Noel Guilbert (noel) - - Jérôme Tamarelle (gromnan) + - bronze1man - Larry Garfield (crell) - Guilherme Blanco (guilhermeblanco) - Martin Schuhfuß (usefulthink) @@ -118,6 +120,7 @@ Symfony2 is the result of the work of many people who made the code better - Pierre Minnieur (pminnieur) - fivestar - Dominique Bongiraud + - Rouven Weßling (realityking) - Leszek Prabucki (l3l0) - François Zaninotto (fzaninotto) - Dustin Whittle (dustinwhittle) @@ -139,6 +142,7 @@ Symfony2 is the result of the work of many people who made the code better - Katsuhiro OGAWA - Andréia Bohner (andreia) - Alif Rachmawadi + - Matthias Pigulla (mpdude) - Joseph Rouff (rouffj) - Félix Labrecque (woodspire) - Christian Flothmann (xabbuh) @@ -155,11 +159,10 @@ Symfony2 is the result of the work of many people who made the code better - Kim Hemsø Rasmussen - Wouter Van Hecke - Michael Holm (hollo) + - Peter Rehm (rpet) - Marc Weistroff (futurecat) - - bronze1man - Roman Marintšenko (inori) - Florian Klein (docteurklein) - - Matthias Pigulla (mpdude) - Manuel Kiessling (manuelkiessling) - Bertrand Zuchuat (garfield-fr) - Gabor Toth (tgabi333) @@ -170,12 +173,13 @@ Symfony2 is the result of the work of many people who made the code better - Aurelijus Valeiša (aurelijus) - Gustavo Piltcher - Stepan Tanasiychuk (stfalcon) - - Luis Cordova (cordoval) - Bob den Otter (bopp) - Adrian Rudnik (kreischweide) - Francesc Rosàs (frosas) + - Julien Galenski (ruian) - Bongiraud Dominique - janschoenherr + - Marco Pivetta (ocramius) - Ricard Clau (ricardclau) - Erin Millard - Matthew Lewinski (lewinski) @@ -193,6 +197,7 @@ Symfony2 is the result of the work of many people who made the code better - Terje Bråten - Kristen Gilden (kgilden) - hossein zolfi (ocean) + - giulio de donato (liuggio) - Philipp Kräutli (pkraeutli) - Kirill chEbba Chebunin (chebba) - Greg Thornton (xdissent) @@ -200,6 +205,7 @@ Symfony2 is the result of the work of many people who made the code better - sun (sun) - Lars Strojny - Costin Bereveanu (schniper) + - Loïc Chardonnet (gnusat) - realmfoo - Tamas Szijarto - Pavel Volokitin (pvolok) @@ -209,6 +215,7 @@ Symfony2 is the result of the work of many people who made the code better - Joe Lencioni - Chekote - Kai + - Stefano Sala (stefano.sala) - Xavier HAUSHERR - Albert Jessurum (ajessu) - Laszlo Korte @@ -219,13 +226,12 @@ Symfony2 is the result of the work of many people who made the code better - Oscar Cubo Medina (ocubom) - Karel Souffriau - Christophe L. (christophelau) - - Julien Galenski (ruian) - Jáchym Toušek - Emanuele Gaspari (inmarelibero) - Brian King - Michel Salib (michelsalib) - geoffrey - - Marco Pivetta (ocramius) + - Florian Voutzinos (florianv) - Nikita Konstantinov - Jeanmonod David (jeanmonod) - Jan Schumann @@ -234,6 +240,7 @@ Symfony2 is the result of the work of many people who made the code better - lancergr - Antonio J. García Lagar (ajgarlag) - Olivier Dolbeau (odolbeau) + - Daniel Tschinder - alquerci - vagrant - Asier Illarramendi (doup) @@ -241,20 +248,20 @@ Symfony2 is the result of the work of many people who made the code better - Vitaliy Tverdokhlib (vitaliytv) - Dirk Pahl (dirkaholic) - Jonas Flodén (flojon) + - Sébastien Lavoie (lavoiesl) - Marcin Sikoń (marphi) + - franek (franek) - Adam Harvey - boombatower - Fabrice Bernhard (fabriceb) - Fabian Lange (codingfabian) - Yoshio HANAWA - - Peter Rehm - Sebastian Bergmann - Pablo Díez (pablodip) - Kevin McBride - Manuel de Ruiter (manuel) - Jérémy Romey (jeremyfreeagent) - Eduardo Oliveira (entering) - - Loïc Chardonnet (gnusat) - Iker Ibarguren (ikerib) - Ricardo Oliveira (ricardolotr) - ondrowan @@ -276,7 +283,6 @@ Symfony2 is the result of the work of many people who made the code better - sasezaki - Denis Gorbachev (starfall) - Steven Surowiec - - giulio de donato (liuggio) - Marek Kalnik (marekkalnik) - Chris Smith - Anthon Pang @@ -314,6 +320,7 @@ Symfony2 is the result of the work of many people who made the code better - Dustin Dobervich (dustin10) - Sebastian Marek (proofek) - Erkhembayar Gantulga (erheme318) + - Kamil Kokot (pamil) - Rostyslav Kinash - Vincent Simonin - Stefan Warman @@ -324,24 +331,28 @@ Symfony2 is the result of the work of many people who made the code better - Chris Heng (gigablah) - Antoine Corcy - cedric lombardot (cedriclombardot) - - franek (franek) - John Kary (johnkary) - François-Xavier de Guillebon (de-gui_f) - Hossein Bukhamsin + - Paweł Wacławczyk (pwc) - Oleg Zinchenko (cystbear) - Diego Saint Esteben (dii3g0) - Johannes Klauss (cloppy) + - Evan Villemez - fzerorubigd - Tiago Brito (blackmx) - develop - Tomasz Kowalczyk (thunderer) - Mark Sonnabaum - Filippo Tessarotto + - Arturas Smorgun (asarturas) + - Alexander Volochnev (exelenz) - Michael Piecko - yclian - Pascal Helfenstein - Baldur Rensch (brensch) - Alex Xandra Albert Sim + - florianv - Yuen-Chi Lian - Besnik Br - Joshua Nye @@ -350,7 +361,6 @@ Symfony2 is the result of the work of many people who made the code better - Lars Vierbergen - Mark Challoner - Andrew Tchircoff (andrewtch) - - Daniel Tschinder - michaelwilliams - Leevi Graham (leevigraham) - Casper Valdemar Poulsen @@ -377,7 +387,6 @@ Symfony2 is the result of the work of many people who made the code better - Thomas Ploch (tploch) - Reen Lokum - Martin Parsiegla (spea) - - Stefano Sala (stefano.sala) - Pierre Vanliefland (pvanliefland) - frost-nzcr4 - Abhoryo @@ -421,6 +430,7 @@ Symfony2 is the result of the work of many people who made the code better - Maks - Gábor Tóth - Daniel Cestari + - Philipp Rieber (bicpi) - Magnus Nordlander (magnusnordlander) - Mikhail Yurasov (mym) - Florian Rey (nervo) @@ -442,6 +452,7 @@ Symfony2 is the result of the work of many people who made the code better - ttomor - Mei Gwilym (meigwilym) - Luciano Mammino (loige) + - fabios - Sander Coolen (scoolen) - Nicolas Le Goff (nlegoff) - Manuele Menozzi @@ -461,10 +472,10 @@ Symfony2 is the result of the work of many people who made the code better - Alex Bogomazov - julien.galenski - Christian Schmidt - - Sébastien Lavoie (lavoiesl) - Per Sandström (per) - Lin Clark - Jeremy David (jeremy.david) + - Florian Lonqueu-Brochard (florianlb) - Troy McCabe - Ville Mattila - Ben Davies @@ -475,9 +486,11 @@ Symfony2 is the result of the work of many people who made the code better - Marcos Quesada (marcos_quesada) - Dan Finnie - Ken Marfilla (marfillaster) + - benatespina (benatespina) - jfcixmedia - Martijn Evers - Benjamin Paap (benjaminpaap) + - Simon Schick (simonsimcity) - Christian - Sergii Smertin (nfx) - Eddie Jaoude @@ -495,27 +508,34 @@ Symfony2 is the result of the work of many people who made the code better - Benoit Garret - DerManoMann - Roland Franssen (ro0) + - Mathieu Lemoine + - Rodrigo Díez Villamuera (rodrigodiez) - Jochen Bayer (jocl) - Jeremy Bush - - Evan Villemez - Péter Buri (burci) - Davide Borsatto (davide.borsatto) - kaiwa - Albert Ganiev (helios-ag) - Neil Katin - peter + - Artem Kolesnikov (tyomo4ka) - Gustavo Adrian - Clément Gautier (clementgautier) + - David de Boer (ddeboer) - Brooks Boyd - Roger Webb - Nicolas Fabre (nfabre) - Raul Rodriguez (raul782) + - Derek Lambert - Felicitus + - Krzysztof Przybyszewski - Paul Matthews - Juan Traverso + - Jerzy Zawadzki - Philipp Strube - Christian Sciberras - Clement Herreman (clemherreman) + - Trent Steel (trsteel88) - Marco - Alberto Aldegheri - heccjj @@ -525,6 +545,7 @@ Symfony2 is the result of the work of many people who made the code better - Mo Di (modi) - Richard van den Brand (ricbra) - Quique Porta (quiqueporta) + - Tomasz Szymczyk (karion) - Aharon Perkel - Malaney J. Hill - Cédric Girard (enk_) @@ -539,6 +560,7 @@ Symfony2 is the result of the work of many people who made the code better - Daniel Wehner - Saem Ghani - Sebastian Utz + - Karol Sójko (karolsojko) - Sébastien HOUZÉ - Samy Dindane (dinduks) - Keri Henare (kerihenare) @@ -550,6 +572,7 @@ Symfony2 is the result of the work of many people who made the code better - George Giannoulopoulos - Daniel Richter (richtermeister) - Chris Wilkinson (thewilkybarkid) + - ChrisC - Ilya Biryukov - Jason Desrosiers - m.chwedziak @@ -559,6 +582,7 @@ Symfony2 is the result of the work of many people who made the code better - Matt Daum (daum) - Alberto Pirovano (geezmo) - Martin Pärtel + - Evgeniy (ewgraf) - Xavier Briand (xavierbriand) - WedgeSama - Romain Geissler @@ -575,6 +599,7 @@ Symfony2 is the result of the work of many people who made the code better - Sebastian Krebs - Rick Prent - Martin Eckhardt + - Jon Gotlin (jongotlin) - Michael Dowling (mtdowling) - Nicolas Grekas (nicolas-grekas) - BilgeXA @@ -588,6 +613,7 @@ Symfony2 is the result of the work of many people who made the code better - fdgdfg (psampaz) - Maxwell Vandervelde - kaywalker + - Mike Meier - Sebastian Ionescu - Simon Neidhold - Kevin Dew @@ -625,7 +651,6 @@ Symfony2 is the result of the work of many people who made the code better - Francisco Facioni (fran6co) - Iwan van Staveren (istaveren) - Povilas S. (povilas) - - Paweł Wacławczyk (pwc) - pborreli - Eric Caron - 2manypeople @@ -678,8 +703,10 @@ Symfony2 is the result of the work of many people who made the code better - Artyom Protaskin - Nathanael d. Noblet - helmer + - Daan van Renterghem - Bram Van der Sype (brammm) - Julien Moulin (lizjulien) + - Matthieu Auger (matthieuauger) - dened - devel - gedrox @@ -693,6 +720,7 @@ Symfony2 is the result of the work of many people who made the code better - tante kinast (tante) - Alexander Zogheb - Florian Pfitzer + - Joel Marcey - David Christmann - root - Tom Maguire @@ -704,7 +732,6 @@ Symfony2 is the result of the work of many people who made the code better - Julien DIDIER (juliendidier) - Martin Mayer (martin) - Grzegorz Łukaszewicz (newicz) - - Rouven Weßling (realityking) - Robert Campbell - Matt Lehner - Alex Pods @@ -731,9 +758,11 @@ Symfony2 is the result of the work of many people who made the code better - Rafał - Masao Maeda (brtriver) - Dave Marshall (davedevelopment) + - David Joos (djoos) - Denis Klementjev (dklementjev) - Kévin Dunglas (dunglas) - Vincent Composieux (eko) + - gondo (gondo) - Osman Üngür (import) - Jorge Martin (jorgemartind) - Kevin Herrera (kherge) @@ -775,8 +804,10 @@ Symfony2 is the result of the work of many people who made the code better - Sylvain Lorinet - jc - BenjaminBeck + - Aurelijus Rožėnas - Christian Eikermann - Antonio Angelino + - Quentin Schuler - Vladimir Sazhin - jamogon - Vyacheslav Slinko @@ -820,7 +851,6 @@ Symfony2 is the result of the work of many people who made the code better - dinitrol - Penny Leach - oscartv - - Philipp Rieber - DanSync - Peter Zwosta - parhs @@ -841,6 +871,7 @@ Symfony2 is the result of the work of many people who made the code better - Chris Sedlmayr (catchamonkey) - Kousuke Ebihara (co3k) - Cas Leentfaar (codeklopper) + - Loïc Vernet (coil) - Christoph Schaefer (cvschaefer) - Damien Alexandre (damienalexandre) - Damon Jones (damon__jones) From ee1e0f2ef882ccd6a53ff91e5ffc39a22b6a6b74 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 5 Jan 2014 02:24:54 +0100 Subject: [PATCH 07/12] updated VERSION for 2.3.9 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 40f376fae2..a01702f1ce 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.9-DEV'; + const VERSION = '2.3.9'; const VERSION_ID = '20309'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '3'; const RELEASE_VERSION = '9'; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; /** * Constructor. From e7df0cfecd5b58a77d65ba11df673b7c1ff14144 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 5 Jan 2014 03:02:09 +0100 Subject: [PATCH 08/12] bumped Symfony version to 2.3.10 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index a01702f1ce..a179efca3a 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.3.9'; - const VERSION_ID = '20309'; + const VERSION = '2.3.10-DEV'; + const VERSION_ID = '20310'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '3'; - const RELEASE_VERSION = '9'; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = '10'; + const EXTRA_VERSION = 'DEV'; /** * Constructor. From ae962797dfe436f06feaaf68d14e8d5a2f57975e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 5 Jan 2014 03:11:29 +0100 Subject: [PATCH 09/12] updated CHANGELOG for 2.4.1 --- CHANGELOG-2.4.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/CHANGELOG-2.4.md b/CHANGELOG-2.4.md index e3dbd537bd..04115910cc 100644 --- a/CHANGELOG-2.4.md +++ b/CHANGELOG-2.4.md @@ -7,6 +7,55 @@ in 2.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.4.0...v2.4.1 +* 2.4.1 (2014-01-05) + + * bug #9938 [Process] Add support SAPI cli-server (peter-gribanov) + * bug #9940 [EventDispatcher] Fix hardcoded listenerTag name in error message (lemoinem) + * bug #9923 [DoctrineBridge] Fixed an issue with DoctrineParserCache (florianv) + * bug #9908 [HttpFoundation] Throw proper exception when invalid data is passed to JsonResponse class (stloyd) + * bug #9902 [Security] fixed pre/post authentication checks (fabpot) + * bug #9910 fixed missing use statements (fabpot) + * bug #9895 [Intl] Added round support for ROUND_CEILING, ROUND_FLOOR, ROUND_DOWN, ROUND_UP (pamil) + * bug #9899 [Filesystem | WCM] 9339 fix stat on url for filesystem copy (cordoval) + * bug #9589 [DependencyInjection] Fixed #9020 - Added support for collections in service#parameters (lavoiesl) + * bug #9889 [Console] fixed column width when using the Table helper with some decoration in cells (fabpot) + * bug #9323 [DomCrawler]fix #9321 Crawler::addHtmlContent add gbk encoding support (bronze1man) + * bug #8997 [Security] Fixed problem with losing ROLE_PREVIOUS_ADMIN role. (pawaclawczyk) + * bug #9557 [DoctrineBridge] Fix for cache-key conflict when having a \Traversable as choices (DRvanR) + * bug #9879 [Security] Fix ExceptionListener to catch correctly AccessDeniedException if is not first exception (fabpot) + * bug #9885 [Dependencyinjection] Fixed handling of inlined references in the AnalyzeServiceReferencesPass (fabpot) + * bug #9884 [DomCrawler] Fixed creating form objects from named form nodes (jakzal) + * bug #9882 Add support for HHVM in the getting of the PHP executable (fabpot) + * bug #9850 [Validator] Fixed IBAN validator with 0750447346 value (stewe) + * bug #9865 [Validator] Fixes message value for objects (jongotlin) + * bug #9441 [Form][DateTimeToArrayTransformer] Check for hour, minute & second validity (egeloen) + * bug #9720 [FrameworkBundle] avoid tables to have apparently long blank line breaks and be too far appart for long nested array params (cordoval) + * bug #9867 #9866 [Filesystem] Fixed mirror for symlinks (COil) + * bug #9806 [Security] Fix parent serialization of user object (ddeboer) + * bug #9834 [DependencyInjection] Fixed support for backslashes in service ids. (jakzal) + * bug #9826 fix #9356 [Security] Logger should manipulate the user reloaded from provider (matthieuauger) + * feature #9775 [FrameworkBundle] Added extra details in XMLDescriptor to improve container description (Exelenz) + * bug #9771 Crawler default namespace fix (crudecki) + * bug #9769 [BrowserKit] fixes #8311 CookieJar is totally ignorant of RFC 6265 edge cases (jzawadzki) + * bug #9697 [Config] fix 5528 let ArrayNode::normalizeValue respect order of value array provided (cordoval) + * bug #9701 [Config] fix #7243 allow 0 as arraynode name (cordoval) + * bug #9795 [Form] Fixed issue in BaseDateTimeTransformer when invalid timezone cause Trans... (tyomo4ka) + * bug #9714 [HttpFoundation] BinaryFileResponse should also return 416 or 200 on some range-requets (SimonSimCity) + * bug #9601 [Routing] Remove usage of deprecated _scheme requirement (Danez) + * bug #9489 [DependencyInjection] Add normalization to tag options (WouterJ) + * bug #9135 [Form] [Validator] fix maxLength guesser (franek) + * bug #9790 [Filesystem] Changed the mode for a target file in copy() to be write only (jakzal) + * bug #9758 [Console] fixed TableHelper when cell value has new line (k-przybyszewski) + * bug #9760 [Routing] Fix router matching pattern against multiple hosts (karolsojko) + * bug #9768 [FrameworkBundle] Fixed bug in XMLDescriptor (Exelenz) + * bug #9700 [ExpressionLanguage] throw exception when parameters contain expressions (aitboudad) + * bug #9674 [Form] rename validators.ua.xlf to validators.uk.xlf (craue) + * bug #9722 [Validator]Fixed getting wrong msg when value is an object in Exception (aitboudad) + * bug #9750 allow TraceableEventDispatcher to reuse event instance in nested events (evillemez) + * bug #9718 [validator] throw an exception if isn't an instance of ConstraintValidatorInterface. (aitboudad) + * bug #9716 Reset the box model to content-box in the web debug toolbar (stof) + * bug #9711 [FrameworkBundle] Allowed "0" as a checkbox value in php templates (jakzal) + * 2.4.0 (2013-12-03) * bug #9673 Fixed BC break in csrf protection (WouterJ) From 377a5fb23bfdc2fb616610b7b7ab7cc9a50e614d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 5 Jan 2014 03:12:11 +0100 Subject: [PATCH 10/12] updated VERSION for 2.4.1 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 5453c3ee15..94353c0422 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.4.1-DEV'; + const VERSION = '2.4.1'; const VERSION_ID = '20401'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '4'; const RELEASE_VERSION = '1'; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; /** * Constructor. From 439664dabd67d58734b13c2f1278a46cca5cd4b0 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 5 Jan 2014 11:33:09 +0100 Subject: [PATCH 11/12] bumped Symfony version to 2.4.2 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 94353c0422..c10b857511 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.4.1'; - const VERSION_ID = '20401'; + const VERSION = '2.4.2-DEV'; + const VERSION_ID = '20402'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '4'; - const RELEASE_VERSION = '1'; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = '2'; + const EXTRA_VERSION = 'DEV'; /** * Constructor. From 146e6663efc5fda7b81b2be56d50345933d0cb9e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Jan 2014 08:27:41 +0100 Subject: [PATCH 12/12] Revert "bug #9601 [Routing] Remove usage of deprecated _scheme requirement (Danez)" This reverts commit 0af3d19c3855b18a8742b82b1d1ea7fe8535c412, reversing changes made to d56cc4b2cb3236a4c1dda4bfc8f09fdf13248536. --- .../Routing/RedirectableUrlMatcherTest.php | 22 +------- .../Generator/Dumper/PhpGeneratorDumper.php | 5 +- .../Routing/Generator/UrlGenerator.php | 23 ++------ .../Matcher/Dumper/PhpMatcherDumper.php | 18 +++---- .../Matcher/RedirectableUrlMatcher.php | 7 ++- .../Routing/Matcher/TraceableUrlMatcher.php | 8 ++- .../Component/Routing/Matcher/UrlMatcher.php | 4 +- src/Symfony/Component/Routing/Route.php | 19 ------- .../Tests/Fixtures/dumper/url_matcher2.php | 10 ++-- .../Dumper/PhpGeneratorDumperTest.php | 33 ------------ .../Tests/Generator/UrlGeneratorTest.php | 54 +++---------------- .../Matcher/RedirectableUrlMatcherTest.php | 30 +---------- .../Routing/Tests/Matcher/UrlMatcherTest.php | 12 +---- .../Component/Routing/Tests/RouteTest.php | 8 --- 14 files changed, 34 insertions(+), 219 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RedirectableUrlMatcherTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RedirectableUrlMatcherTest.php index 282f860262..fe8fc709a6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RedirectableUrlMatcherTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RedirectableUrlMatcherTest.php @@ -38,7 +38,7 @@ class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase ); } - public function testSchemeRedirectBC() + public function testSchemeRedirect() { $coll = new RouteCollection(); $coll->add('foo', new Route('/foo', array(), array('_scheme' => 'https'))); @@ -57,24 +57,4 @@ class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase $matcher->match('/foo') ); } - - public function testSchemeRedirect() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https'))); - - $matcher = new RedirectableUrlMatcher($coll, $context = new RequestContext()); - - $this->assertEquals(array( - '_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction', - 'path' => '/foo', - 'permanent' => true, - 'scheme' => 'https', - 'httpPort' => $context->getHttpPort(), - 'httpsPort' => $context->getHttpsPort(), - '_route' => 'foo', - ), - $matcher->match('/foo') - ); - } } diff --git a/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php b/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php index 4d19d2a2ec..42cd910893 100644 --- a/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php +++ b/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php @@ -92,7 +92,6 @@ EOF; $properties[] = $route->getRequirements(); $properties[] = $compiledRoute->getTokens(); $properties[] = $compiledRoute->getHostTokens(); - $properties[] = $route->getSchemes(); $routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true))); } @@ -115,9 +114,9 @@ EOF; throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', \$name)); } - list(\$variables, \$defaults, \$requirements, \$tokens, \$hostTokens, \$requiredSchemes) = self::\$declaredRoutes[\$name]; + list(\$variables, \$defaults, \$requirements, \$tokens, \$hostTokens) = self::\$declaredRoutes[\$name]; - return \$this->doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$referenceType, \$hostTokens, \$requiredSchemes); + return \$this->doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$referenceType, \$hostTokens); } EOF; } diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php index 468708479b..ac64abc6aa 100644 --- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -137,7 +137,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt // the Route has a cache of its own and is not recompiled as long as it does not get modified $compiledRoute = $route->compile(); - return $this->doGenerate($compiledRoute->getVariables(), $route->getDefaults(), $route->getRequirements(), $compiledRoute->getTokens(), $parameters, $name, $referenceType, $compiledRoute->getHostTokens(), $route->getSchemes()); + return $this->doGenerate($compiledRoute->getVariables(), $route->getDefaults(), $route->getRequirements(), $compiledRoute->getTokens(), $parameters, $name, $referenceType, $compiledRoute->getHostTokens()); } /** @@ -145,7 +145,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt * @throws InvalidParameterException When a parameter value for a placeholder is not correct because * it does not match the requirement */ - protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array()) + protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens) { $variables = array_flip($variables); $mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters); @@ -204,24 +204,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt $schemeAuthority = ''; if ($host = $this->context->getHost()) { $scheme = $this->context->getScheme(); - - if ($requiredSchemes) { - $schemeMatched = false; - foreach ($requiredSchemes as $requiredScheme) { - if ($scheme === $requiredScheme) { - $schemeMatched = true; - - break; - } - } - - if (!$schemeMatched) { - $referenceType = self::ABSOLUTE_URL; - $scheme = current($requiredSchemes); - } - - } elseif (isset($requirements['_scheme']) && ($req = strtolower($requirements['_scheme'])) && $scheme !== $req) { - // We do this for BC; to be removed if _scheme is not supported anymore + if (isset($requirements['_scheme']) && ($req = strtolower($requirements['_scheme'])) && $scheme !== $req) { $referenceType = self::ABSOLUTE_URL; $scheme = $req; } diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index 2b71b9ef5f..dc17ffbe98 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -280,15 +280,14 @@ EOF; EOF; } - if ($schemes = $route->getSchemes()) { + if ($scheme = $route->getRequirement('_scheme')) { if (!$supportsRedirections) { - throw new \LogicException('The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.'); + throw new \LogicException('The "_scheme" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.'); } - $schemes = str_replace("\n", '', var_export(array_flip($schemes), true)); + $code .= <<context->getScheme()])) { - return \$this->redirect(\$pathinfo, '$name', key(\$requiredSchemes)); + if (\$this->context->getScheme() !== '$scheme') { + return \$this->redirect(\$pathinfo, '$name', '$scheme'); } @@ -306,11 +305,8 @@ EOF; } $vars[] = "array('_route' => '$name')"; - $code .= sprintf( - " return \$this->mergeDefaults(array_replace(%s), %s);\n", - implode(', ', $vars), - str_replace("\n", '', var_export($route->getDefaults(), true)) - ); + $code .= sprintf(" return \$this->mergeDefaults(array_replace(%s), %s);\n" + , implode(', ', $vars), str_replace("\n", '', var_export($route->getDefaults(), true))); } elseif ($route->getDefaults()) { $code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_replace($route->getDefaults(), array('_route' => $name)), true))); diff --git a/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php b/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php index e24a15c015..51e80057cd 100644 --- a/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php @@ -51,10 +51,9 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable protected function handleRouteRequirements($pathinfo, $name, Route $route) { // check HTTP scheme requirement - $scheme = $this->context->getScheme(); - $schemes = $route->getSchemes(); - if ($schemes && !$route->hasScheme($scheme)) { - return array(self::ROUTE_MATCH, $this->redirect($pathinfo, $name, current($schemes))); + $scheme = $route->getRequirement('_scheme'); + if ($scheme && $this->context->getScheme() !== $scheme) { + return array(self::ROUTE_MATCH, $this->redirect($pathinfo, $name, $scheme)); } return array(self::REQUIREMENT_MATCH, null); diff --git a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php index 4d09591d7c..ff560c76ca 100644 --- a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php @@ -94,11 +94,9 @@ class TraceableUrlMatcher extends UrlMatcher } // check HTTP scheme requirement - if ($requiredSchemes = $route->getSchemes()) { - $scheme = $this->context->getScheme(); - - if (!$route->hasScheme($scheme)) { - $this->addTrace(sprintf('Scheme "%s" does not match any of the required schemes ("%s"); the user will be redirected to first required scheme', $scheme, implode(', ', $requiredSchemes)), self::ROUTE_ALMOST_MATCHES, $name, $route); + if ($scheme = $route->getRequirement('_scheme')) { + if ($this->context->getScheme() !== $scheme) { + $this->addTrace(sprintf('Scheme "%s" does not match the requirement ("%s"); the user will be redirected', $this->context->getScheme(), $scheme), self::ROUTE_ALMOST_MATCHES, $name, $route); return true; } diff --git a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php index 21d8110622..db18ec4e7b 100644 --- a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -181,8 +181,8 @@ class UrlMatcher implements UrlMatcherInterface protected function handleRouteRequirements($pathinfo, $name, Route $route) { // check HTTP scheme requirement - $scheme = $this->context->getScheme(); - $status = $route->getSchemes() && !$route->hasScheme($scheme) ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; + $scheme = $route->getRequirement('_scheme'); + $status = $scheme && $scheme !== $this->context->getScheme() ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; return array($status, null); } diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index 45034027f1..5bc535c683 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -241,25 +241,6 @@ class Route implements \Serializable return $this; } - /** - * Checks if a scheme requirement has been set. - * - * @param string $scheme - * - * @return Boolean true if the scheme requirement exists, otherwise false - */ - public function hasScheme($scheme) - { - $scheme = strtolower($scheme); - foreach ($this->schemes as $requiredScheme) { - if ($scheme === $requiredScheme) { - return true; - } - } - - return false; - } - /** * Returns the uppercased HTTP methods this route is restricted to. * So an empty array means that any method is allowed. diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index a27be98d39..ad157909b8 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -319,9 +319,8 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // secure if ($pathinfo === '/secure') { - $requiredSchemes = array ( 'https' => 0,); - if (!isset($requiredSchemes[$this->context->getScheme()])) { - return $this->redirect($pathinfo, 'secure', key($requiredSchemes)); + if ($this->context->getScheme() !== 'https') { + return $this->redirect($pathinfo, 'secure', 'https'); } return array('_route' => 'secure'); @@ -329,9 +328,8 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // nonsecure if ($pathinfo === '/nonsecure') { - $requiredSchemes = array ( 'http' => 0,); - if (!isset($requiredSchemes[$this->context->getScheme()])) { - return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)); + if ($this->context->getScheme() !== 'http') { + return $this->redirect($pathinfo, 'nonsecure', 'http'); } return array('_route' => 'nonsecure'); diff --git a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php index 78e3907fd5..ab5f4cdae0 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php @@ -114,37 +114,4 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase $this->assertEquals($url, '/testing'); } - - public function testDumpWithSchemeRequirement() - { - $this->routeCollection->add('Test1', new Route('/testing', array(), array(), array(), '', array('ftp', 'https'))); - $this->routeCollection->add('Test2', new Route('/testing_bc', array(), array('_scheme' => 'https'))); // BC - - file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'SchemeUrlGenerator'))); - include ($this->testTmpFilepath); - - $projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php')); - - $absoluteUrl = $projectUrlGenerator->generate('Test1', array(), true); - $absoluteUrlBC = $projectUrlGenerator->generate('Test2', array(), true); - $relativeUrl = $projectUrlGenerator->generate('Test1', array(), false); - $relativeUrlBC = $projectUrlGenerator->generate('Test2', array(), false); - - $this->assertEquals($absoluteUrl, 'ftp://localhost/app.php/testing'); - $this->assertEquals($absoluteUrlBC, 'https://localhost/app.php/testing_bc'); - $this->assertEquals($relativeUrl, 'ftp://localhost/app.php/testing'); - $this->assertEquals($relativeUrlBC, 'https://localhost/app.php/testing_bc'); - - $projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php', 'GET', 'localhost', 'https')); - - $absoluteUrl = $projectUrlGenerator->generate('Test1', array(), true); - $absoluteUrlBC = $projectUrlGenerator->generate('Test2', array(), true); - $relativeUrl = $projectUrlGenerator->generate('Test1', array(), false); - $relativeUrlBC = $projectUrlGenerator->generate('Test2', array(), false); - - $this->assertEquals($absoluteUrl, 'https://localhost/app.php/testing'); - $this->assertEquals($absoluteUrlBC, 'https://localhost/app.php/testing_bc'); - $this->assertEquals($relativeUrl, '/app.php/testing'); - $this->assertEquals($relativeUrlBC, '/app.php/testing_bc'); - } } diff --git a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index dea0e7f4a9..5f8ef49127 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -248,38 +248,20 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase public function testSchemeRequirementDoesNothingIfSameCurrentScheme() { - $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'http'))); // BC + $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'http'))); $this->assertEquals('/app.php/', $this->getGenerator($routes)->generate('test')); - $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'https'))); // BC - $this->assertEquals('/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); - - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('http'))); - $this->assertEquals('/app.php/', $this->getGenerator($routes)->generate('test')); - - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('https'))); + $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'https'))); $this->assertEquals('/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); } public function testSchemeRequirementForcesAbsoluteUrl() { - $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'https'))); // BC + $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'https'))); $this->assertEquals('https://localhost/app.php/', $this->getGenerator($routes)->generate('test')); - $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'http'))); // BC + $routes = $this->getRoutes('test', new Route('/', array(), array('_scheme' => 'http'))); $this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); - - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('https'))); - $this->assertEquals('https://localhost/app.php/', $this->getGenerator($routes)->generate('test')); - - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('http'))); - $this->assertEquals('http://localhost/app.php/', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test')); - } - - public function testSchemeRequirementCreatesUrlForFirstRequiredScheme() - { - $routes = $this->getRoutes('test', new Route('/', array(), array(), array(), '', array('Ftp', 'https'))); - $this->assertEquals('ftp://localhost/app.php/', $this->getGenerator($routes)->generate('test')); } public function testPathWithTwoStartingSlashes() @@ -465,27 +447,9 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $this->assertNull($generator->generate('test', array('foo' => 'baz'), false)); } - public function testGenerateNetworkPathBC() - { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array('_scheme' => 'http'), array(), '{locale}.example.com')); - - $this->assertSame('//fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', - array('name' =>'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::NETWORK_PATH), 'network path with different host' - ); - $this->assertSame('//fr.example.com/app.php/Fabien?query=string', $this->getGenerator($routes, array('host' => 'fr.example.com'))->generate('test', - array('name' =>'Fabien', 'locale' => 'fr', 'query' => 'string'), UrlGeneratorInterface::NETWORK_PATH), 'network path although host same as context' - ); - $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes, array('scheme' => 'https'))->generate('test', - array('name' =>'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::NETWORK_PATH), 'absolute URL because scheme requirement does not match context' - ); - $this->assertSame('http://fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', - array('name' =>'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::ABSOLUTE_URL), 'absolute URL with same scheme because it is requested' - ); - } - public function testGenerateNetworkPath() { - $routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com', array('http'))); + $routes = $this->getRoutes('test', new Route('/{name}', array(), array('_scheme' => 'http'), array(), '{locale}.example.com')); $this->assertSame('//fr.example.com/app.php/Fabien', $this->getGenerator($routes)->generate('test', array('name' =>'Fabien', 'locale' => 'fr'), UrlGeneratorInterface::NETWORK_PATH), 'network path with different host' @@ -507,8 +471,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $routes->add('article', new Route('/{author}/{article}/')); $routes->add('comments', new Route('/{author}/{article}/comments')); $routes->add('host', new Route('/{article}', array(), array(), array(), '{author}.example.com')); - $routes->add('schemeBC', new Route('/{author}', array(), array('_scheme' => 'https'))); // BC - $routes->add('scheme', new Route('/{author}/blog', array(), array(), array(), '', array('https'))); + $routes->add('scheme', new Route('/{author}', array(), array('_scheme' => 'https'))); $routes->add('unrelated', new Route('/about')); $generator = $this->getGenerator($routes, array('host' => 'example.com', 'pathInfo' => '/fabien/symfony-is-great/')); @@ -528,12 +491,9 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $this->assertSame('//bernhard.example.com/app.php/forms-are-great', $generator->generate('host', array('author' =>'bernhard', 'article' => 'forms-are-great'), UrlGeneratorInterface::RELATIVE_PATH) ); - $this->assertSame('https://example.com/app.php/bernhard', $generator->generate('schemeBC', + $this->assertSame('https://example.com/app.php/bernhard', $generator->generate('scheme', array('author' =>'bernhard'), UrlGeneratorInterface::RELATIVE_PATH) ); - $this->assertSame('https://example.com/app.php/bernhard/blog', $generator->generate('scheme', - array('author' =>'bernhard'), UrlGeneratorInterface::RELATIVE_PATH) - ); $this->assertSame('../../about', $generator->generate('unrelated', array(), UrlGeneratorInterface::RELATIVE_PATH) ); diff --git a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php index 5cbb605479..2ad4fc8725 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -41,7 +41,7 @@ class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase $matcher->match('/foo'); } - public function testSchemeRedirectBC() + public function testSchemeRedirect() { $coll = new RouteCollection(); $coll->add('foo', new Route('/foo', array(), array('_scheme' => 'https'))); @@ -55,32 +55,4 @@ class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase ; $matcher->match('/foo'); } - - public function testSchemeRedirectRedirectsToFirstScheme() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('FTP', 'HTTPS'))); - - $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); - $matcher - ->expects($this->once()) - ->method('redirect') - ->with('/foo', 'foo', 'ftp') - ->will($this->returnValue(array('_route' => 'foo'))) - ; - $matcher->match('/foo'); - } - - public function testNoSchemaRedirectIfOnOfMultipleSchemesMatches() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https', 'http'))); - - $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext())); - $matcher - ->expects($this->never()) - ->method('redirect') - ; - $matcher->match('/foo'); - } } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php index ce0f0ea513..8a1428f170 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php @@ -310,23 +310,13 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $matcher->match('/do.t.html'); } - /** - * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException - */ - public function testSchemeRequirementBC() - { - $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array('_scheme' => 'https'))); - $matcher = new UrlMatcher($coll, new RequestContext()); - $matcher->match('/foo'); - } /** * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException */ public function testSchemeRequirement() { $coll = new RouteCollection(); - $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https'))); + $coll->add('foo', new Route('/foo', array(), array('_scheme' => 'https'))); $matcher = new UrlMatcher($coll, new RequestContext()); $matcher->match('/foo'); } diff --git a/src/Symfony/Component/Routing/Tests/RouteTest.php b/src/Symfony/Component/Routing/Tests/RouteTest.php index c562af8ec2..9f496e259e 100644 --- a/src/Symfony/Component/Routing/Tests/RouteTest.php +++ b/src/Symfony/Component/Routing/Tests/RouteTest.php @@ -152,15 +152,10 @@ class RouteTest extends \PHPUnit_Framework_TestCase { $route = new Route('/'); $this->assertEquals(array(), $route->getSchemes(), 'schemes is initialized with array()'); - $this->assertFalse($route->hasScheme('http')); $route->setSchemes('hTTp'); $this->assertEquals(array('http'), $route->getSchemes(), '->setSchemes() accepts a single scheme string and lowercases it'); - $this->assertTrue($route->hasScheme('htTp')); - $this->assertFalse($route->hasScheme('httpS')); $route->setSchemes(array('HttpS', 'hTTp')); $this->assertEquals(array('https', 'http'), $route->getSchemes(), '->setSchemes() accepts an array of schemes and lowercases them'); - $this->assertTrue($route->hasScheme('htTp')); - $this->assertTrue($route->hasScheme('httpS')); } public function testSchemeIsBC() @@ -169,9 +164,6 @@ class RouteTest extends \PHPUnit_Framework_TestCase $route->setRequirement('_scheme', 'http|https'); $this->assertEquals('http|https', $route->getRequirement('_scheme')); $this->assertEquals(array('http', 'https'), $route->getSchemes()); - $this->assertTrue($route->hasScheme('https')); - $this->assertTrue($route->hasScheme('http')); - $this->assertFalse($route->hasScheme('ftp')); $route->setSchemes(array('hTTp')); $this->assertEquals('http', $route->getRequirement('_scheme')); $route->setSchemes(array());