Merge branch '2.5' into 2.6

* 2.5:
  [Validator] use 2.5 API in LengthValidator
  fixed id for translations
  bumped Symfony version to 2.3.26
  Dutch translation for invalid charset message
  German translation for invalid charset message
  Add a Slovenian translation for invalid charset message
  Add a Polish translation.
  Test lowest deps with latest 5.3
  updated VERSION for 2.3.25
  update CONTRIBUTORS for 2.3.25
  updated CHANGELOG for 2.3.25
  Fix docblocks to comments
  Inject the correct EventDispatcher instance
  [Validator] reject ill-formed strings
  [Validator] drop grapheme_strlen in LengthValidator
  Unique Entity Validator Invalid Value
  [FrameworkBundle][config] allow multiple fallback locales.

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
	src/Symfony/Component/Validator/Resources/translations/validators.de.xlf
	src/Symfony/Component/Validator/Resources/translations/validators.en.xlf
	src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf
	src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf
	src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf
	src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf
This commit is contained in:
Nicolas Grekas 2015-02-01 17:10:57 +01:00
commit c47bbbe5d3
31 changed files with 273 additions and 148 deletions

View File

@ -7,7 +7,7 @@ matrix:
- php: 5.4 - php: 5.4
- php: 5.5 - php: 5.5
- php: 5.6 - php: 5.6
- php: 5.3.3 - php: 5.3
env: components=low env: components=low
- php: 5.6 - php: 5.6
env: components=high env: components=high

View File

@ -7,6 +7,28 @@ in 2.3 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1 To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1
* 2.3.25 (2015-01-30)
* bug #13528 [Validator] reject ill-formed strings (nicolas-grekas)
* bug #13525 [Validator] UniqueEntityValidator - invalidValue fixed. (Dawid Sajdak)
* bug #13527 [Validator] drop grapheme_strlen in LengthValidator (nicolas-grekas)
* bug #13376 [FrameworkBundle][config] allow multiple fallback locales. (aitboudad)
* bug #12972 Make the container considered non-fresh if the environment parameters are changed (thewilkybarkid)
* bug #13309 [Console] fixed 10531 (nacmartin)
* bug #13352 [Yaml] fixed parse shortcut Key after unindented collection. (aitboudad)
* bug #13039 [HttpFoundation] [Request] fix baseUrl parsing to fix wrong path_info (rk3rn3r)
* bug #13250 [Twig][Bridge][TranslationDefaultDomain] add support of named arguments. (aitboudad)
* bug #13332 [Console] ArgvInput and empty tokens (Taluu)
* bug #13293 [EventDispatcher] Add missing checks to RegisterListenersPass (znerol)
* bug #13262 [Yaml] Improve YAML boolean escaping (petert82, larowlan)
* bug #13420 [Debug] fix loading order for legacy classes (nicolas-grekas)
* bug #13371 fix missing comma in YamlDumper (garak)
* bug #13365 [HttpFoundation] Make use of isEmpty() method (xelaris)
* bug #13347 [Console] Helper\TableHelper->addRow optimization (boekkooi)
* bug #13346 [PropertyAccessor] Allow null value for a array (2.3) (boekkooi)
* bug #13170 [Form] Set a child type to text if added to the form without a type. (jakzal)
* bug #13334 [Yaml] Fixed #10597: Improved Yaml directive parsing (VictoriaQ)
* 2.3.24 (2015-01-07) * 2.3.24 (2015-01-07)
* bug #13286 [Security] Don't destroy the session on buggy php releases. (derrabus) * bug #13286 [Security] Don't destroy the session on buggy php releases. (derrabus)

View File

@ -13,19 +13,19 @@ Symfony is the result of the work of many people who made the code better
- Kris Wallsmith (kriswallsmith) - Kris Wallsmith (kriswallsmith)
- Christophe Coevoet (stof) - Christophe Coevoet (stof)
- Nicolas Grekas (nicolas-grekas) - Nicolas Grekas (nicolas-grekas)
- Pascal Borreli (pborreli)
- Jakub Zalas (jakubzalas) - Jakub Zalas (jakubzalas)
- Pascal Borreli (pborreli)
- Hugo Hamon (hhamon)
- Karma Dordrak (drak) - Karma Dordrak (drak)
- Joseph Bielawski (stloyd) - Joseph Bielawski (stloyd)
- Hugo Hamon (hhamon)
- Ryan Weaver (weaverryan) - Ryan Weaver (weaverryan)
- Lukas Kahwe Smith (lsmith) - Lukas Kahwe Smith (lsmith)
- Romain Neutron (romain) - Romain Neutron (romain)
- Jeremy Mikola (jmikola) - Jeremy Mikola (jmikola)
- Jean-François Simon (jfsimon) - Jean-François Simon (jfsimon)
- Christian Flothmann (xabbuh)
- Benjamin Eberlei (beberlei) - Benjamin Eberlei (beberlei)
- Igor Wiedler (igorw) - Igor Wiedler (igorw)
- Christian Flothmann (xabbuh)
- Martin Hasoň (hason) - Martin Hasoň (hason)
- Eriksen Costa (eriksencosta) - Eriksen Costa (eriksencosta)
- Jonathan Wage (jwage) - Jonathan Wage (jwage)
@ -33,9 +33,9 @@ Symfony is the result of the work of many people who made the code better
- Alexandre Salomé (alexandresalome) - Alexandre Salomé (alexandresalome)
- William Durand (couac) - William Durand (couac)
- ornicar - ornicar
- Wouter De Jong (wouterj)
- stealth35 (stealth35) - stealth35 (stealth35)
- Alexander Mols (asm89) - Alexander Mols (asm89)
- Wouter De Jong (wouterj)
- Bulat Shakirzyanov (avalanche123) - Bulat Shakirzyanov (avalanche123)
- Francis Besset (francisbesset) - Francis Besset (francisbesset)
- Saša Stamenković (umpirsky) - Saša Stamenković (umpirsky)
@ -44,15 +44,15 @@ Symfony is the result of the work of many people who made the code better
- Konstantin Kudryashov (everzet) - Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni) - Bilal Amarni (bamarni)
- Florin Patan (florinpatan) - Florin Patan (florinpatan)
- Abdellatif Ait Boudad (aitboudad)
- Eric Clemmons (ericclemmons) - Eric Clemmons (ericclemmons)
- Sarah Khalil (saro0h)
- Andrej Hudec (pulzarraider) - Andrej Hudec (pulzarraider)
- Deni - Deni
- Henrik Westphal (snc) - Henrik Westphal (snc)
- Dariusz Górecki (canni) - Dariusz Górecki (canni)
- Arnout Boks (aboks) - Arnout Boks (aboks)
- Christian Raue - Christian Raue
- Sarah Khalil (saro0h)
- Ait Boudad Abdellatif (aitboudad)
- Michel Weimerskirch (mweimerskirch) - Michel Weimerskirch (mweimerskirch)
- Lee McDermott - Lee McDermott
- Brandon Turner - Brandon Turner
@ -69,6 +69,7 @@ Symfony is the result of the work of many people who made the code better
- Kevin Bond (kbond) - Kevin Bond (kbond)
- Tim Nagel (merk) - Tim Nagel (merk)
- Brice BERNARD (brikou) - Brice BERNARD (brikou)
- Kévin Dunglas (dunglas)
- marc.weistroff - marc.weistroff
- lenar - lenar
- Graham Campbell (graham) - Graham Campbell (graham)
@ -81,7 +82,7 @@ Symfony is the result of the work of many people who made the code better
- Jérôme Tamarelle (gromnan) - Jérôme Tamarelle (gromnan)
- Adrien Brault (adrienbrault) - Adrien Brault (adrienbrault)
- Fabien Pennequin (fabienpennequin) - Fabien Pennequin (fabienpennequin)
- Kévin Dunglas (dunglas) - Peter Kokot (maastermedia)
- Michal Piotrowski (eventhorizon) - Michal Piotrowski (eventhorizon)
- Gordon Franke (gimler) - Gordon Franke (gimler)
- Robert Schönthal (digitalkaoz) - Robert Schönthal (digitalkaoz)
@ -89,13 +90,13 @@ Symfony is the result of the work of many people who made the code better
- Sebastian Hörl (blogsh) - Sebastian Hörl (blogsh)
- Daniel Gomes (danielcsgomes) - Daniel Gomes (danielcsgomes)
- Hidenori Goto (hidenorigoto) - Hidenori Goto (hidenorigoto)
- Peter Kokot (maastermedia)
- David Buchmann (dbu) - David Buchmann (dbu)
- Jérémy DERUSSÉ (jderusse)
- Pablo Godel (pgodel) - Pablo Godel (pgodel)
- Eric GELOEN (gelo) - Eric GELOEN (gelo)
- Peter Rehm (rpet)
- Jérémie Augustin (jaugustin) - Jérémie Augustin (jaugustin)
- Rafael Dohms (rdohms) - Rafael Dohms (rdohms)
- Jérémy DERUSSÉ (jderusse)
- Stefano Sala (stefano.sala) - Stefano Sala (stefano.sala)
- Tigran Azatyan (tigranazatyan) - Tigran Azatyan (tigranazatyan)
- Javier Eguiluz (javier.eguiluz) - Javier Eguiluz (javier.eguiluz)
@ -113,7 +114,6 @@ Symfony is the result of the work of many people who made the code better
- Rouven Weßling (realityking) - Rouven Weßling (realityking)
- Dmitrii Chekaliuk (lazyhammer) - Dmitrii Chekaliuk (lazyhammer)
- Clément JOBEILI (dator) - Clément JOBEILI (dator)
- Peter Rehm (rpet)
- Dorian Villet (gnutix) - Dorian Villet (gnutix)
- Richard Miller (mr_r_miller) - Richard Miller (mr_r_miller)
- Arnaud Kleinpeter (nanocom) - Arnaud Kleinpeter (nanocom)
@ -130,25 +130,27 @@ Symfony is the result of the work of many people who made the code better
- bronze1man - bronze1man
- sun (sun) - sun (sun)
- Larry Garfield (crell) - Larry Garfield (crell)
- Issei Murasawa (issei_m)
- Martin Schuhfuß (usefulthink) - Martin Schuhfuß (usefulthink)
- Thomas Rabaix (rande) - Thomas Rabaix (rande)
- Matthieu Bontemps (mbontemps) - Matthieu Bontemps (mbontemps)
- Pierre Minnieur (pminnieur) - Pierre Minnieur (pminnieur)
- fivestar - fivestar
- Dominique Bongiraud - Dominique Bongiraud
- Iltar van der Berg
- Leszek Prabucki (l3l0) - Leszek Prabucki (l3l0)
- François Zaninotto (fzaninotto) - François Zaninotto (fzaninotto)
- Dustin Whittle (dustinwhittle) - Dustin Whittle (dustinwhittle)
- jeff - jeff
- Justin Hileman (bobthecow) - Justin Hileman (bobthecow)
- Sven Paulus (subsven) - Sven Paulus (subsven)
- Alexander Schwenn (xelaris)
- Lars Strojny (lstrojny) - Lars Strojny (lstrojny)
- Rui Marinho (ruimarinho) - Rui Marinho (ruimarinho)
- Julien Brochet (mewt) - Julien Brochet (mewt)
- Tugdual Saunier (tucksaun) - Tugdual Saunier (tucksaun)
- Sergey Linnik (linniksa) - Sergey Linnik (linniksa)
- Marcel Beerta (mazen) - Marcel Beerta (mazen)
- Iltar van der Berg
- Francois Zaninotto - Francois Zaninotto
- Alexander Kotynia (olden) - Alexander Kotynia (olden)
- Daniel Tschinder - Daniel Tschinder
@ -158,6 +160,7 @@ Symfony is the result of the work of many people who made the code better
- Roman Marintšenko (inori) - Roman Marintšenko (inori)
- Xavier Montaña Carreras (xmontana) - Xavier Montaña Carreras (xmontana)
- Michele Orselli (orso) - Michele Orselli (orso)
- Chris Wilkinson (thewilkybarkid)
- Xavier Perez - Xavier Perez
- Arjen Brouwer (arjenjb) - Arjen Brouwer (arjenjb)
- Katsuhiro OGAWA - Katsuhiro OGAWA
@ -167,7 +170,6 @@ Symfony is the result of the work of many people who made the code better
- Joseph Rouff (rouffj) - Joseph Rouff (rouffj)
- Félix Labrecque (woodspire) - Félix Labrecque (woodspire)
- GordonsLondon - GordonsLondon
- Issei Murasawa (issei_m)
- Jan Sorgalla (jsor) - Jan Sorgalla (jsor)
- Ray - Ray
- Chekote - Chekote
@ -181,10 +183,13 @@ Symfony is the result of the work of many people who made the code better
- Beau Simensen (simensen) - Beau Simensen (simensen)
- Robert Kiss (kepten) - Robert Kiss (kepten)
- Kim Hemsø Rasmussen (kimhemsoe) - Kim Hemsø Rasmussen (kimhemsoe)
- Florian Lonqueu-Brochard (florianlb)
- Tom Van Looy (tvlooy) - Tom Van Looy (tvlooy)
- Wouter Van Hecke - Wouter Van Hecke
- Joshua Thijssen
- Peter Kruithof (pkruithof) - Peter Kruithof (pkruithof)
- Michael Holm (hollo) - Michael Holm (hollo)
- Warnar Boekkooi (boekkooi)
- Marc Weistroff (futurecat) - Marc Weistroff (futurecat)
- Chris Smith (cs278) - Chris Smith (cs278)
- Florian Klein (docteurklein) - Florian Klein (docteurklein)
@ -195,10 +200,10 @@ Symfony is the result of the work of many people who made the code better
- Bertrand Zuchuat (garfield-fr) - Bertrand Zuchuat (garfield-fr)
- Gabor Toth (tgabi333) - Gabor Toth (tgabi333)
- realmfoo - realmfoo
- Chris Wilkinson (thewilkybarkid)
- Thomas Tourlourat (armetiz) - Thomas Tourlourat (armetiz)
- Andrey Esaulov (andremaha) - Andrey Esaulov (andremaha)
- Grégoire Passault (gregwar) - Grégoire Passault (gregwar)
- Mikael Pajunen
- Uwe Jäger (uwej711) - Uwe Jäger (uwej711)
- Aurelijus Valeiša (aurelijus) - Aurelijus Valeiša (aurelijus)
- Jan Decavele (jandc) - Jan Decavele (jandc)
@ -219,7 +224,6 @@ Symfony is the result of the work of many people who made the code better
- alquerci - alquerci
- Francesco Levorato - Francesco Levorato
- Vitaliy Zakharov (zakharovvi) - Vitaliy Zakharov (zakharovvi)
- Florian Lonqueu-Brochard (florianlb)
- Gyula Sallai (salla) - Gyula Sallai (salla)
- Inal DJAFAR (inalgnu) - Inal DJAFAR (inalgnu)
- Christian Gärtner (dagardner) - Christian Gärtner (dagardner)
@ -227,7 +231,6 @@ Symfony is the result of the work of many people who made the code better
- Yaroslav Kiliba - Yaroslav Kiliba
- Sébastien Lavoie (lavoiesl) - Sébastien Lavoie (lavoiesl)
- Terje Bråten - Terje Bråten
- Joshua Thijssen
- Kristen Gilden (kgilden) - Kristen Gilden (kgilden)
- Robbert Klarenbeek (robbertkl) - Robbert Klarenbeek (robbertkl)
- Blanchon Vincent (blanchonvincent) - Blanchon Vincent (blanchonvincent)
@ -239,6 +242,7 @@ Symfony is the result of the work of many people who made the code better
- Philipp Kräutli (pkraeutli) - Philipp Kräutli (pkraeutli)
- Kirill chEbba Chebunin (chebba) - Kirill chEbba Chebunin (chebba)
- Greg Thornton (xdissent) - Greg Thornton (xdissent)
- Baptiste Clavié (talus)
- Grégoire Paris (greg0ire) - Grégoire Paris (greg0ire)
- Costin Bereveanu (schniper) - Costin Bereveanu (schniper)
- Loïc Chardonnet (gnusat) - Loïc Chardonnet (gnusat)
@ -246,7 +250,6 @@ Symfony is the result of the work of many people who made the code better
- Vyacheslav Salakhutdinov (megazoll) - Vyacheslav Salakhutdinov (megazoll)
- Alex Pott - Alex Pott
- Tamas Szijarto - Tamas Szijarto
- Mikael Pajunen
- Pavel Volokitin (pvolok) - Pavel Volokitin (pvolok)
- Endre Fejes - Endre Fejes
- Tobias Naumann (tna) - Tobias Naumann (tna)
@ -254,6 +257,7 @@ Symfony is the result of the work of many people who made the code better
- Shein Alexey - Shein Alexey
- Joe Lencioni - Joe Lencioni
- Kai - Kai
- Lee Rowlands
- Maximilian Reichel (phramz) - Maximilian Reichel (phramz)
- Karoly Negyesi (chx) - Karoly Negyesi (chx)
- Xavier HAUSHERR - Xavier HAUSHERR
@ -275,6 +279,7 @@ Symfony is the result of the work of many people who made the code better
- Michel Salib (michelsalib) - Michel Salib (michelsalib)
- geoffrey - geoffrey
- Matthieu Auger (matthieuauger) - Matthieu Auger (matthieuauger)
- Lorenz Schori
- Jeanmonod David (jeanmonod) - Jeanmonod David (jeanmonod)
- Jan Schumann - Jan Schumann
- Niklas Fiekas - Niklas Fiekas
@ -287,6 +292,7 @@ Symfony is the result of the work of many people who made the code better
- Konstantin Myakshin (koc) - Konstantin Myakshin (koc)
- vagrant - vagrant
- Asier Illarramendi (doup) - Asier Illarramendi (doup)
- Alexander M. Turek (derrabus)
- Chris Sedlmayr (catchamonkey) - Chris Sedlmayr (catchamonkey)
- Seb Koelen - Seb Koelen
- Christoph Mewes (xrstf) - Christoph Mewes (xrstf)
@ -306,7 +312,6 @@ Symfony is the result of the work of many people who made the code better
- Jérôme Macias (jeromemacias) - Jérôme Macias (jeromemacias)
- Fabian Lange (codingfabian) - Fabian Lange (codingfabian)
- Yoshio HANAWA - Yoshio HANAWA
- Baptiste Clavié (talus)
- Sebastian Bergmann - Sebastian Bergmann
- Pablo Díez (pablodip) - Pablo Díez (pablodip)
- Kevin McBride - Kevin McBride
@ -337,6 +342,7 @@ Symfony is the result of the work of many people who made the code better
- Nils Adermann (naderman) - Nils Adermann (naderman)
- Gábor Fási - Gábor Fási
- Benjamin Leveque (benji07) - Benjamin Leveque (benji07)
- Javier Spagnoletti (phansys)
- sasezaki - sasezaki
- Dawid Pakuła (zulusx) - Dawid Pakuła (zulusx)
- Florian Rey (nervo) - Florian Rey (nervo)
@ -348,6 +354,7 @@ Symfony is the result of the work of many people who made the code better
- Ryan - Ryan
- Alexander Deruwe (aderuwe) - Alexander Deruwe (aderuwe)
- François Pluchino (francoispluchino) - François Pluchino (francoispluchino)
- Massimiliano Arione (garak)
- Ivan Rey (ivanrey) - Ivan Rey (ivanrey)
- Marcin Chyłek (songoq) - Marcin Chyłek (songoq)
- Ned Schwartz - Ned Schwartz
@ -356,12 +363,10 @@ Symfony is the result of the work of many people who made the code better
- Zach Badgett (zachbadgett) - Zach Badgett (zachbadgett)
- Aurélien Fredouelle - Aurélien Fredouelle
- Pavel Campr (pcampr) - Pavel Campr (pcampr)
- Alexander Schwenn (xelaris)
- Disquedur - Disquedur
- Geoffrey Tran (geoff) - Geoffrey Tran (geoff)
- Jan Behrens - Jan Behrens
- Sebastian Krebs - Sebastian Krebs
- Lorenz Schori
- Christopher Davis (chrisguitarguy) - Christopher Davis (chrisguitarguy)
- Thomas Lallement (raziel057) - Thomas Lallement (raziel057)
- alcaeus - alcaeus
@ -386,8 +391,6 @@ Symfony is the result of the work of many people who made the code better
- Javier López (loalf) - Javier López (loalf)
- Reinier Kip - Reinier Kip
- Dustin Dobervich (dustin10) - Dustin Dobervich (dustin10)
- Warnar Boekkooi
- Alexander M. Turek (derrabus)
- Sebastian Marek (proofek) - Sebastian Marek (proofek)
- Erkhembayar Gantulga (erheme318) - Erkhembayar Gantulga (erheme318)
- David Fuhr - David Fuhr
@ -410,6 +413,7 @@ Symfony is the result of the work of many people who made the code better
- Antoine Corcy - Antoine Corcy
- Arturs Vonda - Arturs Vonda
- Sascha Grossenbacher - Sascha Grossenbacher
- Szijarto Tamas
- Ben Davies (bendavies) - Ben Davies (bendavies)
- Simon Schick (simonsimcity) - Simon Schick (simonsimcity)
- redstar504 - redstar504
@ -472,7 +476,6 @@ Symfony is the result of the work of many people who made the code better
- Loick Piera (pyrech) - Loick Piera (pyrech)
- cgonzalez - cgonzalez
- Ben - Ben
- Lee Rowlands
- Jayson Xu (superjavason) - Jayson Xu (superjavason)
- Jaik Dean (jaikdean) - Jaik Dean (jaikdean)
- Harm van Tilborg - Harm van Tilborg
@ -490,7 +493,6 @@ Symfony is the result of the work of many people who made the code better
- frost-nzcr4 - frost-nzcr4
- Abhoryo - Abhoryo
- Fabian Vogler (fabian) - Fabian Vogler (fabian)
- Javier Spagnoletti (phansys)
- Korvin Szanto - Korvin Szanto
- Maksim Kotlyar (makasim) - Maksim Kotlyar (makasim)
- Neil Ferreira - Neil Ferreira
@ -538,7 +540,6 @@ Symfony is the result of the work of many people who made the code better
- Maks - Maks
- Gábor Tóth - Gábor Tóth
- Daniel Cestari - Daniel Cestari
- Massimiliano Arione (garak)
- Brunet Laurent (lbrunet) - Brunet Laurent (lbrunet)
- Magnus Nordlander (magnusnordlander) - Magnus Nordlander (magnusnordlander)
- Mikhail Yurasov (mym) - Mikhail Yurasov (mym)
@ -597,6 +598,7 @@ Symfony is the result of the work of many people who made the code better
- Per Sandström (per) - Per Sandström (per)
- Goran Juric - Goran Juric
- Laurent Ghirardotti (laurentg) - Laurent Ghirardotti (laurentg)
- Jan Rosier (rosier)
- Lin Clark - Lin Clark
- Jeremy David (jeremy.david) - Jeremy David (jeremy.david)
- Troy McCabe - Troy McCabe
@ -604,6 +606,7 @@ Symfony is the result of the work of many people who made the code better
- Boris Vujicic (boris.vujicic) - Boris Vujicic (boris.vujicic)
- Max Beutel - Max Beutel
- Catalin Dan - Catalin Dan
- nacho
- Piotr Antosik (antek88) - Piotr Antosik (antek88)
- Artem Lopata - Artem Lopata
- Marcos Quesada (marcos_quesada) - Marcos Quesada (marcos_quesada)
@ -658,7 +661,6 @@ Symfony is the result of the work of many people who made the code better
- Yannick - Yannick
- Luc Vieillescazes (iamluc) - Luc Vieillescazes (iamluc)
- Eduardo García Sanz (coma) - Eduardo García Sanz (coma)
- Szijarto Tamas
- Roy Van Ginneken - Roy Van Ginneken
- David de Boer (ddeboer) - David de Boer (ddeboer)
- Gilles Doge (gido) - Gilles Doge (gido)
@ -673,6 +675,7 @@ Symfony is the result of the work of many people who made the code better
- Derek Lambert - Derek Lambert
- MightyBranch - MightyBranch
- Kacper Gunia (cakper) - Kacper Gunia (cakper)
- Peter Thompson (petert82)
- Felicitus - Felicitus
- Krzysztof Przybyszewski - Krzysztof Przybyszewski
- Paul Matthews - Paul Matthews
@ -700,6 +703,7 @@ Symfony is the result of the work of many people who made the code better
- Aharon Perkel - Aharon Perkel
- Abdul.Mohsen B. A. A - Abdul.Mohsen B. A. A
- Benoît Burnichon - Benoît Burnichon
- pthompson
- Malaney J. Hill - Malaney J. Hill
- Christian Flach (cmfcmf) - Christian Flach (cmfcmf)
- Cédric Girard (enk_) - Cédric Girard (enk_)
@ -738,6 +742,7 @@ Symfony is the result of the work of many people who made the code better
- Jason Desrosiers - Jason Desrosiers
- m.chwedziak - m.chwedziak
- Lance McNearney - Lance McNearney
- Frank Neff (fneff)
- Giorgio Premi - Giorgio Premi
- caponica - caponica
- Matt Daum (daum) - Matt Daum (daum)
@ -784,6 +789,7 @@ Symfony is the result of the work of many people who made the code better
- Klaus Silveira (klaussilveira) - Klaus Silveira (klaussilveira)
- Thomas Chmielowiec (chmielot) - Thomas Chmielowiec (chmielot)
- Jānis Lukss - Jānis Lukss
- rkerner
- Vladyslav Petrovych - Vladyslav Petrovych
- Matthew J Mucklo - Matthew J Mucklo
- fdgdfg (psampaz) - fdgdfg (psampaz)
@ -832,6 +838,7 @@ Symfony is the result of the work of many people who made the code better
- Przemysław Piechota (kibao) - Przemysław Piechota (kibao)
- Leonid Terentyev (li0n) - Leonid Terentyev (li0n)
- Adam Prager (padam87) - Adam Prager (padam87)
- victoria
- Francisco Facioni (fran6co) - Francisco Facioni (fran6co)
- Iwan van Staveren (istaveren) - Iwan van Staveren (istaveren)
- Povilas S. (povilas) - Povilas S. (povilas)
@ -912,6 +919,7 @@ Symfony is the result of the work of many people who made the code better
- Daan van Renterghem - Daan van Renterghem
- Bram Van der Sype (brammm) - Bram Van der Sype (brammm)
- Julien Moulin (lizjulien) - Julien Moulin (lizjulien)
- Nikita Nefedov (nikita2206)
- Yannick Warnier (ywarnier) - Yannick Warnier (ywarnier)
- Kevin Decherf - Kevin Decherf
- Jason Woods - Jason Woods
@ -958,6 +966,7 @@ Symfony is the result of the work of many people who made the code better
- Florian Pfitzer (marmelatze) - Florian Pfitzer (marmelatze)
- Martin Mayer (martin) - Martin Mayer (martin)
- Grzegorz Łukaszewicz (newicz) - Grzegorz Łukaszewicz (newicz)
- Richard van Laak (rvanlaak)
- grifx - grifx
- Robert Campbell - Robert Campbell
- Matt Lehner - Matt Lehner
@ -965,6 +974,7 @@ Symfony is the result of the work of many people who made the code better
- Ruben Kruiswijk - Ruben Kruiswijk
- Michael J - Michael J
- Berny Cantos - Berny Cantos
- Joseph Maarek
- Alex Pods - Alex Pods
- timaschew - timaschew
- Ian Phillips - Ian Phillips
@ -1020,6 +1030,7 @@ Symfony is the result of the work of many people who made the code better
- Pablo Monterde Perez (plebs) - Pablo Monterde Perez (plebs)
- Jimmy Leger (redpanda) - Jimmy Leger (redpanda)
- Cyrille Jouineau (tuxosaurus) - Cyrille Jouineau (tuxosaurus)
- Vadim Kharitonov (virtuozzz)
- Yorkie Chadwick (yorkie76) - Yorkie Chadwick (yorkie76)
- Yanick Witschi - Yanick Witschi
- Ondrej Mirtes - Ondrej Mirtes
@ -1128,6 +1139,7 @@ Symfony is the result of the work of many people who made the code better
- Andreas Forsblom (aforsblo) - Andreas Forsblom (aforsblo)
- Alaattin Kahramanlar (alaattin) - Alaattin Kahramanlar (alaattin)
- Alex Olmos (alexolmos) - Alex Olmos (alexolmos)
- Alain Hippolyte (aloneh)
- Antonio Mansilla (amansilla) - Antonio Mansilla (amansilla)
- Juan Ases García (ases) - Juan Ases García (ases)
- Daniel Basten (axhm3a) - Daniel Basten (axhm3a)

View File

@ -244,35 +244,34 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
->assertRaised(); ->assertRaised();
} }
public function testValidateUniquenessAfterConsideringMultipleQueryResults() public function testValidateUniquenessWithValidCustomErrorPath()
{ {
$constraint = new UniqueEntity(array( $constraint = new UniqueEntity(array(
'message' => 'myMessage', 'message' => 'myMessage',
'fields' => array('name'), 'fields' => array('name', 'name2'),
'em' => self::EM_NAME, 'em' => self::EM_NAME,
'errorPath' => "name2",
)); ));
$entity1 = new SingleIntIdEntity(1, 'Foo'); $entity1 = new DoubleNameEntity(1, 'Foo', "Bar");
$entity2 = new SingleIntIdEntity(2, 'Foo'); $entity2 = new DoubleNameEntity(2, 'Foo', "Bar");
$this->validator->validate($entity1, $constraint);
$this->assertNoViolation();
$this->em->persist($entity1); $this->em->persist($entity1);
$this->em->persist($entity2);
$this->em->flush(); $this->em->flush();
$this->validator->validate($entity1, $constraint); $this->validator->validate($entity1, $constraint);
$this->buildViolation('myMessage') $this->assertNoViolation();
->atPath('property.path.name')
->setInvalidValue('Foo')
->assertRaised();
$this->context->getViolations()->remove(0);
$this->validator->validate($entity2, $constraint); $this->validator->validate($entity2, $constraint);
$this->buildViolation('myMessage') $this->buildViolation('myMessage')
->atPath('property.path.name') ->atPath('property.path.name2')
->setInvalidValue('Foo') ->setInvalidValue('Bar')
->assertRaised(); ->assertRaised();
} }

View File

@ -132,10 +132,11 @@ class UniqueEntityValidator extends ConstraintValidator
} }
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
$invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]];
$this->buildViolation($constraint->message) $this->buildViolation($constraint->message)
->atPath($errorPath) ->atPath($errorPath)
->setInvalidValue($criteria[$fields[0]]) ->setInvalidValue($invalidValue)
->addViolation(); ->addViolation();
} }
} }

View File

@ -184,7 +184,7 @@ class ModelChoiceList extends ObjectChoiceList
return array(); return array();
} }
/** /*
* This performance optimization reflects a common scenario: * This performance optimization reflects a common scenario:
* * A simple select of a model entry. * * A simple select of a model entry.
* * The choice option "expanded" is set to false. * * The choice option "expanded" is set to false.
@ -239,7 +239,7 @@ class ModelChoiceList extends ObjectChoiceList
} }
if (!$this->loaded) { if (!$this->loaded) {
/** /*
* This performance optimization assumes the validation of the respective values will be done by other means. * This performance optimization assumes the validation of the respective values will be done by other means.
* *
* It correlates with the performance optimization in {@link ModelChoiceList::getChoicesForValues()} * It correlates with the performance optimization in {@link ModelChoiceList::getChoicesForValues()}

View File

@ -449,8 +449,13 @@ class Configuration implements ConfigurationInterface
->arrayNode('translator') ->arrayNode('translator')
->info('translator configuration') ->info('translator configuration')
->canBeEnabled() ->canBeEnabled()
->fixXmlConfig('fallback')
->children() ->children()
->scalarNode('fallback')->defaultValue('en')->end() ->arrayNode('fallbacks')
->beforeNormalization()->ifString()->then(function ($v) { return array($v); })->end()
->prototype('scalar')->end()
->defaultValue(array('en'))
->end()
->booleanNode('logging')->defaultValue($this->debug)->end() ->booleanNode('logging')->defaultValue($this->debug)->end()
->end() ->end()
->end() ->end()

View File

@ -298,7 +298,7 @@ class FrameworkExtension extends Extension
'memcached' => 'Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage', 'memcached' => 'Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage',
'redis' => 'Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage', 'redis' => 'Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage',
); );
list($class,) = explode(':', $config['dsn'], 2); list($class, ) = explode(':', $config['dsn'], 2);
if (!isset($supported[$class])) { if (!isset($supported[$class])) {
throw new \LogicException(sprintf('Driver "%s" is not supported for the profiler.', $class)); throw new \LogicException(sprintf('Driver "%s" is not supported for the profiler.', $class));
} }
@ -633,10 +633,7 @@ class FrameworkExtension extends Extension
// Use the "real" translator instead of the identity default // Use the "real" translator instead of the identity default
$container->setAlias('translator', 'translator.default'); $container->setAlias('translator', 'translator.default');
$translator = $container->findDefinition('translator.default'); $translator = $container->findDefinition('translator.default');
if (!is_array($config['fallback'])) { $translator->addMethodCall('setFallbackLocales', array($config['fallbacks']));
$config['fallback'] = array($config['fallback']);
}
$translator->addMethodCall('setFallbackLocales', array($config['fallback']));
$container->setParameter('translator.logging', $config['logging']); $container->setParameter('translator.logging', $config['logging']);

View File

@ -157,6 +157,9 @@
</xsd:complexType> </xsd:complexType>
<xsd:complexType name="translator"> <xsd:complexType name="translator">
<xsd:sequence>
<xsd:element name="fallback" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="enabled" type="xsd:boolean" /> <xsd:attribute name="enabled" type="xsd:boolean" />
<xsd:attribute name="fallback" type="xsd:string" /> <xsd:attribute name="fallback" type="xsd:string" />
<xsd:attribute name="logging" type="xsd:boolean" /> <xsd:attribute name="logging" type="xsd:boolean" />

View File

@ -122,7 +122,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
), ),
'translator' => array( 'translator' => array(
'enabled' => false, 'enabled' => false,
'fallback' => 'en', 'fallbacks' => array('en'),
'logging' => true, 'logging' => true,
), ),
'validation' => array( 'validation' => array(

View File

@ -0,0 +1,7 @@
<?php
$container->loadFromExtension('framework', array(
'translator' => array(
'fallbacks' => array('en', 'fr'),
),
));

View File

@ -0,0 +1,15 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config secret="s3cr3t">
<framework:translator enabled="true">
<framework:fallback>en</framework:fallback>
<framework:fallback>fr</framework:fallback>
</framework:translator>
</framework:config>
</container>

View File

@ -0,0 +1,3 @@
framework:
translator:
fallbacks: [en, fr]

View File

@ -261,6 +261,14 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertEquals(array('fr'), $calls[0][1][0]); $this->assertEquals(array('fr'), $calls[0][1][0]);
} }
public function testTranslatorMultipleFullback()
{
$container = $this->createContainerFromFile('translator_fallbacks');
$calls = $container->getDefinition('translator.default')->getMethodCalls();
$this->assertEquals(array('en', 'fr'), $calls[0][1][0]);
}
/** /**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
*/ */

View File

@ -216,7 +216,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
$this->dispatcher->removeListener($eventName, $listener); $this->dispatcher->removeListener($eventName, $listener);
$info = $this->getListenerInfo($listener, $eventName); $info = $this->getListenerInfo($listener, $eventName);
$name = isset($info['class']) ? $info['class'] : $info['type']; $name = isset($info['class']) ? $info['class'] : $info['type'];
$this->dispatcher->addListener($eventName, new WrappedListener($listener, $name, $this->stopwatch)); $this->dispatcher->addListener($eventName, new WrappedListener($listener, $name, $this->stopwatch, $this));
} }
} }

View File

@ -25,12 +25,14 @@ class WrappedListener
private $called; private $called;
private $stoppedPropagation; private $stoppedPropagation;
private $stopwatch; private $stopwatch;
private $dispatcher;
public function __construct($listener, $name, Stopwatch $stopwatch) public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
{ {
$this->listener = $listener; $this->listener = $listener;
$this->name = $name; $this->name = $name;
$this->stopwatch = $stopwatch; $this->stopwatch = $stopwatch;
$this->dispatcher = $dispatcher;
$this->called = false; $this->called = false;
$this->stoppedPropagation = false; $this->stoppedPropagation = false;
} }
@ -56,7 +58,7 @@ class WrappedListener
$e = $this->stopwatch->start($this->name, 'event_listener'); $e = $this->stopwatch->start($this->name, 'event_listener');
call_user_func($this->listener, $event, $eventName, $dispatcher); call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher);
if ($e->isStarted()) { if ($e->isStarted()) {
$e->stop(); $e->stop();

View File

@ -86,6 +86,20 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(), $tdispatcher->getNotCalledListeners()); $this->assertEquals(array(), $tdispatcher->getNotCalledListeners());
} }
public function testGetCalledListenersNested()
{
$tdispatcher = null;
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$dispatcher->addListener('foo', function (Event $event, $eventName, $dispatcher) use (&$tdispatcher) {
$tdispatcher = $dispatcher;
$dispatcher->dispatch('bar');
});
$dispatcher->addListener('bar', function (Event $event) {});
$dispatcher->dispatch('foo');
$this->assertSame($dispatcher, $tdispatcher);
$this->assertCount(2, $dispatcher->getCalledListeners());
}
public function testLogger() public function testLogger()
{ {
$logger = $this->getMock('Psr\Log\LoggerInterface'); $logger = $this->getMock('Psr\Log\LoggerInterface');

View File

@ -11,11 +11,8 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
/** // Adds SessionHandler functionality if available.
* Adds SessionHandler functionality if available. // @see http://php.net/sessionhandler
*
* @see http://php.net/sessionhandler
*/
if (PHP_VERSION_ID >= 50400) { if (PHP_VERSION_ID >= 50400) {
class NativeSessionHandler extends \SessionHandler class NativeSessionHandler extends \SessionHandler
{ {

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Exception; namespace Symfony\Component\HttpKernel\Exception;
/** /*
* Fatal Error Exception. * Fatal Error Exception.
* *
* @author Konstanton Myakshin <koc-dp@yandex.ru> * @author Konstanton Myakshin <koc-dp@yandex.ru>

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Exception; namespace Symfony\Component\HttpKernel\Exception;
/** /*
* FlattenException wraps a PHP Exception to be able to serialize it. * FlattenException wraps a PHP Exception to be able to serialize it.
* *
* Basically, this class removes all objects from the trace. * Basically, this class removes all objects from the trace.

View File

@ -373,11 +373,9 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
} elseif ($key === '#') { } elseif ($key === '#') {
$append = $this->selectNodeType($parentNode, $data); $append = $this->selectNodeType($parentNode, $data);
} elseif (is_array($data) && false === is_numeric($key)) { } elseif (is_array($data) && false === is_numeric($key)) {
/** // Is this array fully numeric keys?
* Is this array fully numeric keys?
*/
if (ctype_digit(implode('', array_keys($data)))) { if (ctype_digit(implode('', array_keys($data)))) {
/** /*
* Create nodes to append to $parentNode based on the $key of this array * Create nodes to append to $parentNode based on the $key of this array
* Produces <xml><item>0</item><item>1</item></xml> * Produces <xml><item>0</item><item>1</item></xml>
* From array("item" => array(0,1));. * From array("item" => array(0,1));.

View File

@ -27,72 +27,52 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
class CardSchemeValidator extends ConstraintValidator class CardSchemeValidator extends ConstraintValidator
{ {
protected $schemes = array( protected $schemes = array(
/** // American Express card numbers start with 34 or 37 and have 15 digits.
* American Express card numbers start with 34 or 37 and have 15 digits.
*/
'AMEX' => array( 'AMEX' => array(
'/^3[47][0-9]{13}$/', '/^3[47][0-9]{13}$/',
), ),
/** // China UnionPay cards start with 62 and have between 16 and 19 digits.
* China UnionPay cards start with 62 and have between 16 and 19 digits. // Please note that these cards do not follow Luhn Algorithm as a checksum.
* Please note that these cards do not follow Luhn Algorithm as a checksum.
*/
'CHINA_UNIONPAY' => array( 'CHINA_UNIONPAY' => array(
'/^62[0-9]{14,17}$/', '/^62[0-9]{14,17}$/',
), ),
/** // Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits.
* Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits. // There are Diners Club cards that begin with 5 and have 16 digits.
* There are Diners Club cards that begin with 5 and have 16 digits. // These are a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard.
* These are a joint venture between Diners Club and MasterCard, and should be processed like a MasterCard.
*/
'DINERS' => array( 'DINERS' => array(
'/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/',
), ),
/** // Discover card numbers begin with 6011, 622126 through 622925, 644 through 649 or 65.
* Discover card numbers begin with 6011, 622126 through 622925, 644 through 649 or 65. // All have 16 digits.
* All have 16 digits.
*/
'DISCOVER' => array( 'DISCOVER' => array(
'/^6011[0-9]{12}$/', '/^6011[0-9]{12}$/',
'/^64[4-9][0-9]{13}$/', '/^64[4-9][0-9]{13}$/',
'/^65[0-9]{14}$/', '/^65[0-9]{14}$/',
'/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/', '/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/',
), ),
/** // InstaPayment cards begin with 637 through 639 and have 16 digits.
* InstaPayment cards begin with 637 through 639 and have 16 digits.
*/
'INSTAPAYMENT' => array( 'INSTAPAYMENT' => array(
'/^63[7-9][0-9]{13}$/', '/^63[7-9][0-9]{13}$/',
), ),
/** // JCB cards beginning with 2131 or 1800 have 15 digits.
* JCB cards beginning with 2131 or 1800 have 15 digits. // JCB cards beginning with 35 have 16 digits.
* JCB cards beginning with 35 have 16 digits.
*/
'JCB' => array( 'JCB' => array(
'/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/', '/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/',
), ),
/** // Laser cards begin with either 6304, 6706, 6709 or 6771 and have between 16 and 19 digits.
* Laser cards begin with either 6304, 6706, 6709 or 6771 and have between 16 and 19 digits.
*/
'LASER' => array( 'LASER' => array(
'/^(6304|670[69]|6771)[0-9]{12,15}$/', '/^(6304|670[69]|6771)[0-9]{12,15}$/',
), ),
/** // Maestro cards begin with either 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763 or 0604
* Maestro cards begin with either 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763 or 0604 // They have between 12 and 19 digits.
* They have between 12 and 19 digits.
*/
'MAESTRO' => array( 'MAESTRO' => array(
'/^(5018|5020|5038|6304|6759|6761|676[23]|0604)[0-9]{8,15}$/', '/^(5018|5020|5038|6304|6759|6761|676[23]|0604)[0-9]{8,15}$/',
), ),
/** // All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
* All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
*/
'MASTERCARD' => array( 'MASTERCARD' => array(
'/^5[1-5][0-9]{14}$/', '/^5[1-5][0-9]{14}$/',
), ),
/** // All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
* All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
*/
'VISA' => array( 'VISA' => array(
'/^4([0-9]{12}|[0-9]{15})$/', '/^4([0-9]{12}|[0-9]{15})$/',
), ),

View File

@ -35,6 +35,7 @@ class Length extends Constraint
public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.'; public $maxMessage = 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.';
public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.'; public $minMessage = 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.';
public $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.'; public $exactMessage = 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.';
public $charsetMessage = 'This value does not match the expected {{ charset }} charset.';
public $max; public $max;
public $min; public $min;
public $charset = 'UTF-8'; public $charset = 'UTF-8';

View File

@ -38,13 +38,39 @@ class LengthValidator extends ConstraintValidator
} }
$stringValue = (string) $value; $stringValue = (string) $value;
$invalidCharset = false;
if (function_exists('grapheme_strlen') && 'UTF-8' === $constraint->charset) { if ('UTF8' === $charset = strtoupper($constraint->charset)) {
$length = grapheme_strlen($stringValue); $charset = 'UTF-8';
}
if (function_exists('iconv_strlen')) {
$length = @iconv_strlen($stringValue, $constraint->charset);
$invalidCharset = false === $length;
} elseif (function_exists('mb_strlen')) { } elseif (function_exists('mb_strlen')) {
$length = mb_strlen($stringValue, $constraint->charset); if (mb_check_encoding($stringValue, $constraint->charset)) {
} else { $length = mb_strlen($stringValue, $constraint->charset);
} else {
$invalidCharset = true;
}
} elseif ('UTF-8' !== $charset) {
$length = strlen($stringValue); $length = strlen($stringValue);
} elseif (!preg_match('//u', $stringValue)) {
$invalidCharset = true;
} elseif (function_exists('utf8_decode')) {
$length = strlen(utf8_decode($stringValue));
} else {
preg_replace('/./u', '', $stringValue, -1, $length);
}
if ($invalidCharset) {
$this->buildViolation($constraint->charsetMessage)
->setParameter('{{ value }}', $this->formatValue($stringValue))
->setParameter('{{ charset }}', $constraint->charset)
->setInvalidValue($value)
->addViolation();
return;
} }
if (null !== $constraint->max && $length > $constraint->max) { if (null !== $constraint->max && $length > $constraint->max) {

View File

@ -302,6 +302,10 @@
<source>An empty file is not allowed.</source> <source>An empty file is not allowed.</source>
<target>Eine leere Datei ist nicht erlaubt.</target> <target>Eine leere Datei ist nicht erlaubt.</target>
</trans-unit> </trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Dieser Wert entspricht nicht dem erwarteten Zeichensatz {{ charset }}.</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View File

@ -302,6 +302,10 @@
<source>An empty file is not allowed.</source> <source>An empty file is not allowed.</source>
<target>An empty file is not allowed.</target> <target>An empty file is not allowed.</target>
</trans-unit> </trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>This value does not match the expected {{ charset }} charset.</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View File

@ -302,6 +302,10 @@
<source>An empty file is not allowed.</source> <source>An empty file is not allowed.</source>
<target>Un fichier vide n'est pas autorisé.</target> <target>Un fichier vide n'est pas autorisé.</target>
</trans-unit> </trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Cette valeur ne correspond pas au jeu de caractères {{ charset }} attendu.</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View File

@ -302,6 +302,10 @@
<source>An empty file is not allowed.</source> <source>An empty file is not allowed.</source>
<target>Lege bestanden zijn niet toegestaan.</target> <target>Lege bestanden zijn niet toegestaan.</target>
</trans-unit> </trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Deze waarde is niet in de verwachte tekencodering {{ charset }}.</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View File

@ -302,6 +302,10 @@
<source>An empty file is not allowed.</source> <source>An empty file is not allowed.</source>
<target>Plik nie może być pusty.</target> <target>Plik nie może być pusty.</target>
</trans-unit> </trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Ta wartość nie pasuje do oczekiwanego zestawu znaków {{ charset }}.</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View File

@ -302,6 +302,10 @@
<source>An empty file is not allowed.</source> <source>An empty file is not allowed.</source>
<target>Prazna datoteka ni dovoljena.</target> <target>Prazna datoteka ni dovoljena.</target>
</trans-unit> </trans-unit>
<trans-unit id="80">
<source>This value does not match the expected {{ charset }} charset.</source>
<target>Ta vrednost se ne ujema s pričakovanim naborom znakov {{ charset }}.</target>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View File

@ -54,12 +54,12 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
return array( return array(
array(12), array(12),
array('12'), array('12'),
array('üü', true), array('üü'),
array('éé', true), array('éé'),
array(123), array(123),
array('123'), array('123'),
array('üüü', true), array('üüü'),
array('ééé', true), array('ééé'),
); );
} }
@ -68,8 +68,8 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
return array( return array(
array(1234), array(1234),
array('1234'), array('1234'),
array('üüüü', true), array('üüüü'),
array('éééé', true), array('éééé'),
); );
} }
@ -78,24 +78,34 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
return array( return array(
array(12345), array(12345),
array('12345'), array('12345'),
array('üüüüü', true), array('üüüüü'),
array('ééééé', true), array('ééééé'),
array(123456), array(123456),
array('123456'), array('123456'),
array('üüüüüü', true), array('üüüüüü'),
array('éééééé', true), array('éééééé'),
);
}
public function getOneCharset()
{
if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) {
$this->markTestSkipped('Mbstring or iconv is required for this test.');
}
return array(
array("é", "utf8", true),
array("\xE9", "CP1252", true),
array("\xE9", "XXX", false),
array("\xE9", "utf8", false),
); );
} }
/** /**
* @dataProvider getFiveOrMoreCharacters * @dataProvider getFiveOrMoreCharacters
*/ */
public function testValidValuesMin($value, $mbOnly = false) public function testValidValuesMin($value)
{ {
if ($mbOnly && !function_exists('mb_strlen')) {
$this->markTestSkipped('mb_strlen does not exist');
}
$constraint = new Length(array('min' => 5)); $constraint = new Length(array('min' => 5));
$this->validator->validate($value, $constraint); $this->validator->validate($value, $constraint);
@ -105,12 +115,8 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
/** /**
* @dataProvider getThreeOrLessCharacters * @dataProvider getThreeOrLessCharacters
*/ */
public function testValidValuesMax($value, $mbOnly = false) public function testValidValuesMax($value)
{ {
if ($mbOnly && !function_exists('mb_strlen')) {
$this->markTestSkipped('mb_strlen does not exist');
}
$constraint = new Length(array('max' => 3)); $constraint = new Length(array('max' => 3));
$this->validator->validate($value, $constraint); $this->validator->validate($value, $constraint);
@ -120,12 +126,8 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
/** /**
* @dataProvider getFourCharacters * @dataProvider getFourCharacters
*/ */
public function testValidValuesExact($value, $mbOnly = false) public function testValidValuesExact($value)
{ {
if ($mbOnly && !function_exists('mb_strlen')) {
$this->markTestSkipped('mb_strlen does not exist');
}
$constraint = new Length(4); $constraint = new Length(4);
$this->validator->validate($value, $constraint); $this->validator->validate($value, $constraint);
@ -135,12 +137,8 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
/** /**
* @dataProvider getThreeOrLessCharacters * @dataProvider getThreeOrLessCharacters
*/ */
public function testInvalidValuesMin($value, $mbOnly = false) public function testInvalidValuesMin($value)
{ {
if ($mbOnly && !function_exists('mb_strlen')) {
$this->markTestSkipped('mb_strlen does not exist');
}
$constraint = new Length(array( $constraint = new Length(array(
'min' => 4, 'min' => 4,
'minMessage' => 'myMessage', 'minMessage' => 'myMessage',
@ -160,12 +158,8 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
/** /**
* @dataProvider getFiveOrMoreCharacters * @dataProvider getFiveOrMoreCharacters
*/ */
public function testInvalidValuesMax($value, $mbOnly = false) public function testInvalidValuesMax($value)
{ {
if ($mbOnly && !function_exists('mb_strlen')) {
$this->markTestSkipped('mb_strlen does not exist');
}
$constraint = new Length(array( $constraint = new Length(array(
'max' => 4, 'max' => 4,
'maxMessage' => 'myMessage', 'maxMessage' => 'myMessage',
@ -185,12 +179,8 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
/** /**
* @dataProvider getThreeOrLessCharacters * @dataProvider getThreeOrLessCharacters
*/ */
public function testInvalidValuesExactLessThanFour($value, $mbOnly = false) public function testInvalidValuesExactLessThanFour($value)
{ {
if ($mbOnly && !function_exists('mb_strlen')) {
$this->markTestSkipped('mb_strlen does not exist');
}
$constraint = new Length(array( $constraint = new Length(array(
'min' => 4, 'min' => 4,
'max' => 4, 'max' => 4,
@ -211,12 +201,8 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
/** /**
* @dataProvider getFiveOrMoreCharacters * @dataProvider getFiveOrMoreCharacters
*/ */
public function testInvalidValuesExactMoreThanFour($value, $mbOnly = false) public function testInvalidValuesExactMoreThanFour($value)
{ {
if ($mbOnly && !function_exists('mb_strlen')) {
$this->markTestSkipped('mb_strlen does not exist');
}
$constraint = new Length(array( $constraint = new Length(array(
'min' => 4, 'min' => 4,
'max' => 4, 'max' => 4,
@ -234,6 +220,31 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
->assertRaised(); ->assertRaised();
} }
/**
* @dataProvider getOneCharset
*/
public function testOneCharset($value, $charset, $isValid)
{
$constraint = new Length(array(
'min' => 1,
'max' => 1,
'charset' => $charset,
'charsetMessage' => 'myMessage',
));
$this->validator->validate($value, $constraint);
if ($isValid) {
$this->assertNoViolation();
} else {
$this->buildViolation('myMessage')
->setParameter('{{ value }}', '"'.$value.'"')
->setParameter('{{ charset }}', $charset)
->setInvalidValue($value)
->assertRaised();
}
}
public function testConstraintGetDefaultOption() public function testConstraintGetDefaultOption()
{ {
$constraint = new Length(5); $constraint = new Length(5);