Merge branch '2.4'

* 2.4:
  Revert "bug #9601 [Routing] Remove usage of deprecated _scheme requirement (Danez)"
  bumped Symfony version to 2.4.2
  updated VERSION for 2.4.1
  updated CHANGELOG for 2.4.1
  bumped Symfony version to 2.3.10
  updated VERSION for 2.3.9
  update CONTRIBUTORS for 2.3.9
  updated CHANGELOG for 2.3.9
  Add support SAPI cli-server
  Fix hardcoded listenerTag name in error message
  [HttpFoundation] Documented public properties.
  [Routing] add missing unit tests for Route and RouteCollection classes

Conflicts:
	src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php
	src/Symfony/Component/HttpKernel/Kernel.php
This commit is contained in:
Fabien Potencier 2014-01-06 08:29:39 +01:00
commit 6063b499e7
21 changed files with 265 additions and 249 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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')
);
}
}

View File

@ -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'])) {

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -288,15 +288,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 .= <<<EOF
\$requiredSchemes = $schemes;
if (!isset(\$requiredSchemes[\$this->context->getScheme()])) {
return \$this->redirect(\$pathinfo, '$name', key(\$requiredSchemes));
if (\$this->context->getScheme() !== '$scheme') {
return \$this->redirect(\$pathinfo, '$name', '$scheme');
}
@ -314,11 +313,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)));

View File

@ -56,10 +56,9 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable
}
// 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);

View File

@ -103,11 +103,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;
}

View File

@ -205,8 +205,8 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
}
// 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);
}

View File

@ -247,25 +247,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.

View File

@ -321,9 +321,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');
@ -331,9 +330,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');

View File

@ -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');
}
}

View File

@ -244,38 +244,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()
@ -461,27 +443,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'
@ -503,8 +467,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/'));
@ -524,12 +487,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)
);

View File

@ -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');
}
}

View File

@ -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');
}

View File

@ -258,4 +258,47 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('context.getMethod() == "POST"', $routea->getCondition());
$this->assertEquals('context.getMethod() == "POST"', $routeb->getCondition());
}
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());
}
}

View File

@ -63,6 +63,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}');
@ -75,7 +84,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');
@ -106,8 +115,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');
}
/**
@ -142,15 +153,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()
@ -159,9 +165,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());
@ -206,4 +209,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);
}
}