diff --git a/.gitignore b/.gitignore index f16d739d03..76f1ab9a39 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ -.php_cs.cache -autoload.php +vendor/ composer.lock -composer.phar -package*.tar -packages.json phpunit.xml -/vendor/ +.php_cs.cache +composer.phar +package.tar +/packages.json diff --git a/.travis.php b/.travis.php new file mode 100644 index 0000000000..c27942913a --- /dev/null +++ b/.travis.php @@ -0,0 +1,45 @@ + $_SERVER['argc']) { + echo "Usage: commit-range branch dir1 dir2 ... dirN\n"; + exit(1); +} + +$dirs = $_SERVER['argv']; +array_shift($dirs); +$range = array_shift($dirs); +$branch = array_shift($dirs); + +$packages = array(); +$flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0; + +foreach ($dirs as $dir) { + if (!`git diff --name-only $range -- $dir`) { + continue; + } + echo "$dir\n"; + + $package = json_decode(file_get_contents($dir.'/composer.json')); + + $package->repositories = array(array( + 'type' => 'composer', + 'url' => 'file://'.__DIR__.'/', + )); + file_put_contents($dir.'/composer.json', json_encode($package, $flags)); + passthru("cd $dir && tar -cf package.tar --exclude='package.tar' *"); + + $package->version = $branch.'.x-dev'; + $package->dist['type'] = 'tar'; + $package->dist['url'] = 'file://'.__DIR__."/$dir/package.tar"; + + $packages[$package->name][$package->version] = $package; + + $versions = file_get_contents('https://packagist.org/packages/'.$package->name.'.json'); + $versions = json_decode($versions); + + foreach ($versions->package->versions as $version => $package) { + $packages[$package->name] += array($version => $package); + } +} + +file_put_contents('packages.json', json_encode(compact('packages'), $flags)); diff --git a/.travis.sh b/.travis.sh deleted file mode 100644 index 55020cb012..0000000000 --- a/.travis.sh +++ /dev/null @@ -1,24 +0,0 @@ -branch=$1 -if [ -z "$branch" ]; then - echo 'Usage: branch dir1 dir2 ... dirN' - exit 1 -fi -shift -components=$* -if [ -z "$components" ]; then - echo 'Usage: branch dir1 dir2 ... dirN' - exit 1 -fi -echo '{"packages": {' > packages.json -for c in $components; do - sed -i ':a;N;$!ba;s#^{\n\(\s*\)\("name"\)#{\n\1"repositories": \[{ "type": "composer", "url": "file://'$(pwd)'/" }\],\n\1\2#' $c/composer.json - n=$(php -r '$n=json_decode(file_get_contents("'$c'/composer.json"));echo $n->name;') - echo '"'$n'": {"'$branch'.x-dev": ' >> packages.json - cat $c/composer.json >> packages.json - echo '"version": "'$branch.x-dev'",\n "dist": {"type": "tar", "url": "file://'$(pwd)/$c'/package'$branch'.tar"}\n}},' >> packages.json -done; -sed -i ':a;N;$!ba;s/\n}\n"/,\n "/g' packages.json -sed -i ':a;N;$!ba;s/}},$/\n}}\n}}/' packages.json -for c in $components; do - (cd $c && tar -cf package$branch.tar --exclude='package*.tar' *) -done diff --git a/.travis.yml b/.travis.yml index d5e9f8aec2..cb9b540711 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,7 @@ env: before_install: - composer self-update + - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; @@ -44,7 +45,7 @@ install: - if [ "$deps" = "no" ]; then export SYMFONY_DEPRECATIONS_HELPER=strict; fi; - if [ "$deps" = "no" ]; then composer --prefer-source install; fi; - components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') - - if [ "$deps" != "no" ]; then sh .travis.sh $TRAVIS_BRANCH $components; fi; + - if [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $components; fi; - if [ "$deps" = "2.8" ]; then git fetch origin 2.8; git checkout -m FETCH_HEAD; export COMPOSER_ROOT_VERSION=2.8.x-dev; fi; script: diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f3397b53ec..af5724f4a7 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -15,11 +15,11 @@ Symfony is the result of the work of many people who made the code better - Christophe Coevoet (stof) - Jakub Zalas (jakubzalas) - Pascal Borreli (pborreli) + - Christian Flothmann (xabbuh) - Hugo Hamon (hhamon) - Joseph Bielawski (stloyd) - Karma Dordrak (drak) - Ryan Weaver (weaverryan) - - Christian Flothmann (xabbuh) - Lukas Kahwe Smith (lsmith) - Romain Neutron (romain) - Jeremy Mikola (jmikola) @@ -27,22 +27,23 @@ Symfony is the result of the work of many people who made the code better - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Martin Hasoň (hason) - - Eriksen Costa (eriksencosta) - Abdellatif Ait boudad (aitboudad) + - Eriksen Costa (eriksencosta) - Grégoire Pineau (lyrixx) - Wouter De Jong (wouterj) - Jonathan Wage (jwage) - Alexandre Salomé (alexandresalome) - William Durand (couac) + - Kévin Dunglas (dunglas) - ornicar - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - - Kévin Dunglas (dunglas) - Bulat Shakirzyanov (avalanche123) - Francis Besset (francisbesset) - Saša Stamenković (umpirsky) - Henrik Bjørnskov (henrikbjorn) - Miha Vrhovnik + - Diego Saint Esteben (dii3g0) - Sarah Khalil (saro0h) - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) @@ -55,15 +56,14 @@ Symfony is the result of the work of many people who made the code better - Arnout Boks (aboks) - Christian Raue - Michel Weimerskirch (mweimerskirch) - - Diego Saint Esteben (dii3g0) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - Douglas Greenshields (shieldo) + - Kevin Bond (kbond) - Daniel Holmes (dholmes) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) - - Kevin Bond (kbond) - John Wards (johnwards) - Fran Moreno (franmomu) - Antoine Hérault (herzult) @@ -71,6 +71,7 @@ Symfony is the result of the work of many people who made the code better - Gábor Egyed (1ed) - Arnaud Le Blanc (arnaud-lb) - Tim Nagel (merk) + - Maxime Steinhausser (ogizanagi) - Brice BERNARD (brikou) - marc.weistroff - lenar @@ -83,16 +84,16 @@ Symfony is the result of the work of many people who made the code better - excelwebzone - Jacob Dreesen (jdreesen) - Matthias Pigulla (mpdude) - - Fabien Pennequin (fabienpennequin) - - Peter Kokot (maastermedia) - - Peter Rehm (rpet) - - Michal Piotrowski (eventhorizon) - - Stefano Sala (stefano.sala) - Javier Eguiluz (javier.eguiluz) + - Fabien Pennequin (fabienpennequin) + - Peter Rehm (rpet) + - Peter Kokot (maastermedia) - Gordon Franke (gimler) - Robert Schönthal (digitalkaoz) - - Juti Noppornpitak (shiroyuki) - Dariusz Ruminski + - Michal Piotrowski (eventhorizon) + - Stefano Sala (stefano.sala) + - Juti Noppornpitak (shiroyuki) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) @@ -102,10 +103,13 @@ Symfony is the result of the work of many people who made the code better - Pablo Godel (pgodel) - Eric GELOEN (gelo) - Jérémie Augustin (jaugustin) - - Rafael Dohms (rdohms) - - Tigran Azatyan (tigranazatyan) - Alexander Schwenn (xelaris) + - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) + - Joshua Thijssen + - Vladimir Reznichenko (kalessil) + - Tigran Azatyan (tigranazatyan) + - Issei Murasawa (issei_m) - Richard Shank (iampersistent) - Clemens Tolboom - Helmer Aaviksoo @@ -113,15 +117,16 @@ Symfony is the result of the work of many people who made the code better - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) - - Issei Murasawa (issei_m) - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba + - Iltar van der Berg - Rouven Weßling (realityking) - Andréia Bohner (andreia) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) - Dorian Villet (gnutix) + - Javier Spagnoletti (phansys) - Richard Miller (mr_r_miller) - hacfi (hifi) - Mario A. Alvarez Garcia (nomack84) @@ -136,21 +141,17 @@ Symfony is the result of the work of many people who made the code better - Larry Garfield (crell) - Martin Schuhfuß (usefulthink) - Thomas Rabaix (rande) - - Javier Spagnoletti (phansys) - Matthieu Bontemps (mbontemps) - Pierre Minnieur (pminnieur) - fivestar - Dominique Bongiraud - - Iltar van der Berg - Leszek Prabucki (l3l0) - François Zaninotto (fzaninotto) - Dustin Whittle (dustinwhittle) - jeff - - Maxime Steinhausser (ogizanagi) - - Joshua Thijssen - Justin Hileman (bobthecow) - Sven Paulus (subsven) - - Vladimir Reznichenko (kalessil) + - Warnar Boekkooi (boekkooi) - Lars Strojny (lstrojny) - Rui Marinho (ruimarinho) - Mikael Pajunen @@ -158,11 +159,14 @@ Symfony is the result of the work of many people who made the code better - Tugdual Saunier (tucksaun) - Sergey Linnik (linniksa) - Marcel Beerta (mazen) + - Vincent AUBERT (vincent) - julien pauli (jpauli) - Francois Zaninotto - Alexander Kotynia (olden) - Daniel Tschinder + - Alexander M. Turek (derrabus) - Elnur Abdurrakhimov (elnur) + - John Kary (johnkary) - Manuel Reinhard (sprain) - Danny Berger (dpb587) - Roman Marintšenko (inori) @@ -187,11 +191,10 @@ Symfony is the result of the work of many people who made the code better - Jeremy Livingston (jeremylivingston) - Nikita Konstantinov - Wodor Wodorski - - Vincent AUBERT (vincent) - Matthieu Auger (matthieuauger) + - Sébastien Lavoie (lavoiesl) - Beau Simensen (simensen) - Robert Kiss (kepten) - - John Kary (johnkary) - Ruben Gonzalez (rubenrua) - Kim Hemsø Rasmussen (kimhemsoe) - Florian Lonqueu-Brochard (florianlb) @@ -199,8 +202,8 @@ Symfony is the result of the work of many people who made the code better - Wouter Van Hecke - Peter Kruithof (pkruithof) - Michael Holm (hollo) - - Warnar Boekkooi (boekkooi) - Marc Weistroff (futurecat) + - Kristen Gilden (kgilden) - Chris Smith (cs278) - Florian Klein (docteurklein) - Manuel Kiessling (manuelkiessling) @@ -226,6 +229,7 @@ Symfony is the result of the work of many people who made the code better - Julien Galenski (ruian) - Bongiraud Dominique - janschoenherr + - Thomas Schulz (king2500) - Marco Pivetta (ocramius) - Ricard Clau (ricardclau) - Erin Millard @@ -235,18 +239,18 @@ Symfony is the result of the work of many people who made the code better - Vitaliy Zakharov (zakharovvi) - Tobias Sjösten (tobiassjosten) - Gyula Sallai (salla) - - Alexander M. Turek (derrabus) - Konstantin Myakshin (koc) - Inal DJAFAR (inalgnu) - Christian Gärtner (dagardner) + - Tomasz Kowalczyk (thunderer) + - Daniel Wehner - Felix Labrecque - Yaroslav Kiliba - - Sébastien Lavoie (lavoiesl) - Stepan Anchugov (kix) - Terje Bråten - - Kristen Gilden (kgilden) - Robbert Klarenbeek (robbertkl) - Blanchon Vincent (blanchonvincent) + - Dawid Nowak - hossein zolfi (ocean) - Clément Gautier (clementgautier) - Eduardo Gulias (egulias) @@ -261,6 +265,7 @@ Symfony is the result of the work of many people who made the code better - Loïc Chardonnet (gnusat) - Marek Kalnik (marekkalnik) - Vyacheslav Salakhutdinov (megazoll) + - Hassan Amouhzi - Tamas Szijarto - Pavel Volokitin (pvolok) - Endre Fejes @@ -283,9 +288,9 @@ Symfony is the result of the work of many people who made the code better - Oscar Cubo Medina (ocubom) - Karel Souffriau - Christophe L. (christophelau) + - Massimiliano Arione (garak) - Anthon Pang (robocoder) - Jáchym Toušek - - Thomas Schulz (king2500) - Jannik Zschiesche (apfelbox) - Emanuele Gaspari (inmarelibero) - Dariusz Rumiński @@ -304,7 +309,6 @@ Symfony is the result of the work of many people who made the code better - Asier Illarramendi (doup) - Chris Sedlmayr (catchamonkey) - Seb Koelen - - Daniel Wehner - Christoph Mewes (xrstf) - Vitaliy Tverdokhlib (vitaliytv) - Ariel Ferrandini (aferrandini) @@ -313,7 +317,9 @@ Symfony is the result of the work of many people who made the code better - Jonas Flodén (flojon) - Christian Schmidt - Marcin Sikoń (marphi) + - Dominik Zogg (dominik.zogg) - franek (franek) + - Damien Alexandre (damienalexandre) - Adam Harvey - Alex Bakhturin - François-Xavier de Guillebon (de-gui_f) @@ -322,7 +328,6 @@ Symfony is the result of the work of many people who made the code better - Jérôme Macias (jeromemacias) - Fabian Lange (codingfabian) - Yoshio HANAWA - - Tomasz Kowalczyk (thunderer) - Sebastian Bergmann - Pablo Díez (pablodip) - Kevin McBride @@ -359,6 +364,7 @@ Symfony is the result of the work of many people who made the code better - Nils Adermann (naderman) - Gábor Fási - Benjamin Leveque (benji07) + - Ivan Kurnosov - sasezaki - Dawid Pakuła (zulusx) - Florian Rey (nervo) @@ -369,13 +375,14 @@ Symfony is the result of the work of many people who made the code better - Daniel Tschinder - Ryan - Alexander Deruwe (aderuwe) + - Dave Hulbert (dave1010) - François Pluchino (francoispluchino) - - Massimiliano Arione (garak) - Ivan Rey (ivanrey) - Marcin Chyłek (songoq) - Ned Schwartz - Ziumin - Lenar Lõhmus + - Benjamin Laugueux (yzalis) - Zach Badgett (zachbadgett) - Aurélien Fredouelle - Pavel Campr (pcampr) @@ -416,6 +423,7 @@ Symfony is the result of the work of many people who made the code better - David Fuhr - Kamil Kokot (pamil) - Rostyslav Kinash + - Maciej Malarz (malarzm) - Daisuke Ohata - Vincent Simonin - Stefan Warman @@ -428,7 +436,6 @@ Symfony is the result of the work of many people who made the code better - umpirski - Chris Heng (gigablah) - Ulumuddin Yunus (joenoez) - - Dominik Zogg (dominik.zogg) - Luc Vieillescazes (iamluc) - Johann Saunier (prophet777) - Antoine Corcy @@ -461,9 +468,11 @@ Symfony is the result of the work of many people who made the code better - Alexander Volochnev (exelenz) - Michael Piecko - yclian + - Sergio Santoro - Sebastian Grodzicki (sgrodzicki) - Pascal Helfenstein - Baldur Rensch (brensch) + - Vladyslav Petrovych - Alex Xandra Albert Sim - Yuen-Chi Lian - Besnik Br @@ -485,6 +494,7 @@ Symfony is the result of the work of many people who made the code better - Marc Morera (mmoreram) - Andrew Hilobok (hilobok) - Christian Soronellas (theunic) + - Romain Gautier (mykiwi) - Yosmany Garcia (yosmanyga) - Degory Valentine - Benoit Lévêque (benoit_leveque) @@ -501,7 +511,7 @@ Symfony is the result of the work of many people who made the code better - fago - Harm van Tilborg - Jan Prieser - - Damien Alexandre (damienalexandre) + - Artur Melo (restless) - James Michael DuPont - Tom Klingenberg - Christopher Hall (mythmakr) @@ -510,14 +520,17 @@ Symfony is the result of the work of many people who made the code better - Berny Cantos (xphere81) - Reen Lokum - Martin Parsiegla (spea) + - Possum + - Denis Charrier (brucewouaigne) - Quentin Schuler - Pierre Vanliefland (pvanliefland) - frost-nzcr4 + - Oskar Stark (oskarstark) - Abhoryo - Fabian Vogler (fabian) - Korvin Szanto + - MatTheCat - Maksim Kotlyar (makasim) - - Ivan Kurnosov - Neil Ferreira - Dmitry Parnas (parnas) - DQNEO @@ -541,10 +554,11 @@ Symfony is the result of the work of many people who made the code better - Shin Ohno (ganchiku) - Geert De Deckere (geertdd) - Jan Kramer (jankramer) + - Jean-Baptiste GOMOND (mjbgo) + - Richard van Laak (rvanlaak) - abdul malik ikhsan (samsonasik) - Henry Snoek (snoek09) - Timothée Barray (tyx) - - Benjamin Laugueux (yzalis) - Christian Morgan - Alexander Miehe (engerim) - Morgan Auchede (mauchede) @@ -578,6 +592,7 @@ Symfony is the result of the work of many people who made the code better - Raul Fraile (raulfraile) - sensio - Patrick Kaufmann + - Reece Fowell (reecefowell) - stefan.r - Matthieu Napoli (mnapoli) - Ben Ramsey (ramsey) @@ -594,22 +609,26 @@ Symfony is the result of the work of many people who made the code better - Michael Tibben - Sander Marechal - Radosław Benkel + - Gennady Telegin (gtelegin) - Marcos Sánchez - ttomor - Mei Gwilym (meigwilym) - Michael H. Arieli (excelwebzone) - Luciano Mammino (loige) - fabios + - Jérôme Vasseur - Sander Coolen (scoolen) - Nicolas Le Goff (nlegoff) - Manuele Menozzi - Anton Babenko (antonbabenko) - Irmantas Šiupšinskas (irmantas) + - Charles-Henri Bruyand - Danilo Silva - Zachary Tong (polyfractal) - Hryhorii Hrebiniuk - dantleech - Xavier Leune + - Christian Schmidt - Tero Alén (tero) - DerManoMann - Guillaume Royer @@ -671,12 +690,12 @@ Symfony is the result of the work of many people who made the code better - Marcin Chwedziak - Roland Franssen (ro0) - Tony Cosentino (tony-co) - - Maciej Malarz - Rodrigo Díez Villamuera (rodrigodiez) - e-ivanov - Jochen Bayer (jocl) - Jeremy Bush - wizhippo + - Diego Saint Esteben (dosten) - rpg600 - Péter Buri (burci) - Davide Borsatto (davide.borsatto) @@ -701,6 +720,7 @@ Symfony is the result of the work of many people who made the code better - Brooks Boyd - Roger Webb - Dmitriy Simushev + - Martin Hujer (martinhujer) - Max Voloshin (maxvoloshin) - Nicolas Fabre (nfabre) - Raul Rodriguez (raul782) @@ -747,6 +767,7 @@ Symfony is the result of the work of many people who made the code better - Tatsuya Tsuruoka - Ross Tuck - Kévin Gomez (kevin) + - azine - Dawid Sajdak - Ludek Stepan - Geoffrey Brier @@ -769,6 +790,7 @@ Symfony is the result of the work of many people who made the code better - Cédric Lahouste (rapotor) - Samuel Vogel (samuelvogel) - Berat Doğan + - twifty - Anthony Ferrara - ShiraNai7 - Janusz Jabłoński (yanoosh) @@ -812,6 +834,7 @@ Symfony is the result of the work of many people who made the code better - Samuel Gordalina (gordalina) - Max Romanovsky (maxromanovsky) - Mathieu Morlon + - Daniel Tschinder - Rafał Muszyński (rafmus90) - Timothy Anido (xanido) - Rick Prent @@ -829,7 +852,6 @@ Symfony is the result of the work of many people who made the code better - Thomas Chmielowiec (chmielot) - Jānis Lukss - rkerner - - Vladyslav Petrovych - Matthew J Mucklo - fdgdfg (psampaz) - Stéphane Seng @@ -846,6 +868,7 @@ Symfony is the result of the work of many people who made the code better - Jonathan Gough - Benjamin Bender - Konrad Mohrfeldt + - Lance Chen - kor3k kor3k (kor3k) - Stelian Mocanita (stelian) - Flavian (2much) @@ -877,7 +900,6 @@ Symfony is the result of the work of many people who made the code better - Adrian Olek (adrianolek) - Przemysław Piechota (kibao) - Leonid Terentyev (li0n) - - Oskar Stark (oskarstark) - Adam Prager (padam87) - ryunosuke - victoria @@ -892,7 +914,6 @@ Symfony is the result of the work of many people who made the code better - catch - Alexandre Segura - Josef Cech - - Possum - Arnau González (arnaugm) - Nate (frickenate) - Matthew Foster (mfoster) @@ -930,6 +951,7 @@ Symfony is the result of the work of many people who made the code better - Grayson Koonce (breerly) - Karim Cassam Chenaï (ka) - Nicolas Bastien (nicolas_bastien) + - Andrew Zhilin (zhil) - Andy Stanberry - Luiz “Felds” Liscia - Thomas Rothe @@ -937,11 +959,13 @@ Symfony is the result of the work of many people who made the code better - avi123 - alsar - Mike Meier + - michalmarcinkowski - Warwick - Chris - efeen - Michał Dąbrowski (defrag) - Simone Fumagalli (hpatoio) + - Brian Graham (incognito) - Kevin Vergauwen (innocenzo) - Alessio Baglio (ioalessio) - John Bafford (jbafford) @@ -960,7 +984,6 @@ Symfony is the result of the work of many people who made the code better - Daan van Renterghem - Bram Van der Sype (brammm) - Julien Moulin (lizjulien) - - Romain Gautier (mykiwi) - Nikita Nefedov (nikita2206) - Mauro Foti (skler) - Yannick Warnier (ywarnier) @@ -989,7 +1012,6 @@ Symfony is the result of the work of many people who made the code better - Mark de Haan (markdehaan) - Dan Patrick (mdpatrick) - Rares Vlaseanu (raresvla) - - Artur Melo (restless) - Sofiane HADDAG (sofhad) - tante kinast (tante) - Vincent LEFORT (vlefort) @@ -1013,7 +1035,6 @@ Symfony is the result of the work of many people who made the code better - Florian Pfitzer (marmelatze) - Martin Mayer (martin) - Grzegorz Łukaszewicz (newicz) - - Richard van Laak (rvanlaak) - grifx - Robert Campbell - Matt Lehner @@ -1022,6 +1043,7 @@ Symfony is the result of the work of many people who made the code better - Ruben Kruiswijk - Michael J - Joseph Maarek + - Alexander Menk - Alex Pods - timaschew - Ian Phillips @@ -1040,6 +1062,7 @@ Symfony is the result of the work of many people who made the code better - Maerlyn - Even André Fiskvik - Diego Agulló + - Gerrit Drost - Lenar Lõhmus - Cristian Gonzalez - Juan M Martínez @@ -1056,7 +1079,6 @@ Symfony is the result of the work of many people who made the code better - Jeroen Thora (bolle) - Masao Maeda (brtriver) - Darius Leskauskas (darles) - - Dave Hulbert (dave1010) - David Joos (djoos) - Denis Klementjev (dklementjev) - Tomáš Polívka (draczris) @@ -1085,6 +1107,7 @@ Symfony is the result of the work of many people who made the code better - akimsko - Youpie - srsbiz + - Taylan Kasap - Nicolas A. Bérard-Nault - Gladhon - Saem Ghani @@ -1108,6 +1131,7 @@ Symfony is the result of the work of many people who made the code better - Wotre - goohib - Xavier HAUSHERR + - Mantas Urnieža - Cas - Dusan Kasan - Myke79 @@ -1142,6 +1166,7 @@ Symfony is the result of the work of many people who made the code better - andreabreu98 - Michael Schneider - n-aleha + - Şəhriyar İmanov - Kaipi Yann - Sam Williams - Adrian Philipp @@ -1150,6 +1175,7 @@ Symfony is the result of the work of many people who made the code better - Ondrej Slinták - vlechemin - Brian Corrigan + - Ladislav Tánczos - Brian Freytag - Skorney - mieszko4 @@ -1175,6 +1201,7 @@ Symfony is the result of the work of many people who made the code better - Sergiy Sokolenko - dinitrol - Penny Leach + - Richard Trebichavský - g123456789l - Giorgio Premi - oscartv @@ -1200,6 +1227,7 @@ Symfony is the result of the work of many people who made the code better - Alex Olmos (alexolmos) - Antonio Mansilla (amansilla) - Juan Ases García (ases) + - Siragusa (asiragusa) - Daniel Basten (axhm3a) - DUPUCH (bdupuch) - Bill Hance (billhance) @@ -1239,6 +1267,7 @@ Symfony is the result of the work of many people who made the code better - Adam Monsen (meonkeys) - Ala Eddine Khefifi (nayzo) - emilienbouard (neime) + - Nicholas Byfleet (nickbyfleet) - ollie harridge (ollietb) - Paul Andrieux (paulandrieux) - Paweł Szczepanek (pauluz) @@ -1270,6 +1299,7 @@ Symfony is the result of the work of many people who made the code better - Jesper Søndergaard Pedersen (zerrvox) - Florent Cailhol - szymek + - Kovacs Nicolas - craigmarvelley - Stano Turza - simpson @@ -1281,6 +1311,7 @@ Symfony is the result of the work of many people who made the code better - fh-github@fholzhauer.de - Mark Topper - Xavier REN + - Zander Baldwin - Philipp Scheit - max - Mohamed Karnichi (amiral) diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index d3347acaa1..3ccdceee29 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -87,7 +87,7 @@ abstract class DoctrineType extends AbstractType */ public static function createChoiceName($choice, $key, $value) { - return (string) $value; + return str_replace('-', '_', (string) $value); } /** diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index e22db0093c..b9680b45e5 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -495,6 +495,31 @@ class EntityTypeTest extends TypeTestCase $this->assertSame('3', $field['3']->getViewData()); } + public function testSubmitMultipleExpandedWithNegativeIntegerId() + { + $entity1 = new SingleIntIdEntity(-1, 'Foo'); + $entity2 = new SingleIntIdEntity(2, 'Bar'); + + $this->persist(array($entity1, $entity2)); + + $field = $this->factory->createNamed('name', 'entity', null, array( + 'multiple' => true, + 'expanded' => true, + 'em' => 'default', + 'class' => self::SINGLE_IDENT_CLASS, + 'choice_label' => 'name', + )); + + $field->submit(array('-1')); + + $expected = new ArrayCollection(array($entity1)); + + $this->assertTrue($field->isSynchronized()); + $this->assertEquals($expected, $field->getData()); + $this->assertTrue($field['_1']->getData()); + $this->assertFalse($field['2']->getData()); + } + public function testOverrideChoices() { $entity1 = new SingleIntIdEntity(1, 'Foo'); diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 066534bf12..a64b9c7397 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -33,20 +33,20 @@ "doctrine/annotations": "~1.0" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7|~3.0.0", - "symfony/browser-kit": "~2.4|~3.0.0", - "symfony/console": "~2.7|~3.0.0", - "symfony/css-selector": "~2.0,>=2.0.5|~3.0.0", - "symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0", - "symfony/finder": "~2.0,>=2.0.5|~3.0.0", - "symfony/intl": "~2.3|~3.0.0", - "symfony/security": "~2.6|~3.0.0", - "symfony/form": "~2.8|~3.0.0", - "symfony/class-loader": "~2.1|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/process": "~2.0,>=2.0.5|~3.0.0", - "symfony/validator": "~2.5|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0" + "symfony/phpunit-bridge": "~2.8|~3.0", + "symfony/browser-kit": "~2.8|~3.0", + "symfony/console": "~2.8|~3.0", + "symfony/css-selector": "~2.8|~3.0", + "symfony/dom-crawler": "~2.8|~3.0", + "symfony/finder": "~2.8|~3.0", + "symfony/intl": "~2.8|~3.0", + "symfony/security": "~2.8|~3.0", + "symfony/form": "~2.8|~3.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0", + "symfony/validator": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" }, "suggest": { "symfony/console": "For using the console commands", diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 2748910a19..cada4ee6ca 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -91,6 +91,10 @@ class ProfilerController $panel = $request->query->get('panel', 'request'); $page = $request->query->get('page', 'home'); + if ('latest' === $token && $latest = current($this->profiler->find(null, null, 1, null, null, null))) { + $token = $latest['token']; + } + if (!$profile = $this->profiler->loadProfile($token)) { return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token)), 200, array('Content-Type' => 'text/html')); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig index aeffb2cf25..9be617a3ec 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig @@ -25,10 +25,17 @@ The token already exists in the database.

{% elseif about == 'no_token' %} -

Token not found

-

- Token "{{ token }}" was not found in the database. -

+ {% if token == 'latest' %} +

No profiles

+

+ No profiles found in the database. +

+ {% else %} +

Token not found

+

+ Token "{{ token }}" was not found in the database. +

+ {% endif %} {% endif %} {% endblock %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig index 12728b964d..6df82890c1 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig @@ -14,6 +14,7 @@ {% if profile %}
View last 10 + View latest Profile for: {{ profile.method|upper }} {% if profile.method|upper in ['GET', 'HEAD'] %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig index 4d84a6931c..fd32565347 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig @@ -217,7 +217,7 @@ li { border-top-right-radius: 16px; line-height: 18px; } -a#resume-view-all { +a#resume-view-all, a#resume-view-latest { display: inline-block; padding: 0.2em 0.7em; margin-right: 0.5em; diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php index a61b410d51..a36c739e56 100644 --- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php +++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php @@ -162,7 +162,7 @@ class ChoiceQuestion extends Question throw new \InvalidArgumentException(sprintf($errorMessage, $value)); } - $multiselectChoices[] = $choices[(string) $result]; + $multiselectChoices[] = (string) $result; } if ($multiselect) { diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index 99c89edc0e..a1f85b1740 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -36,15 +36,18 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase $questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n")); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2'); + $question->setMaxAttempts(1); // first answer is an empty answer, we're supposed to receive the default value $this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes); + $question->setMaxAttempts(1); $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes); $question->setErrorMessage('Input "%s" is not a superhero!'); + $question->setMaxAttempts(2); $this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); rewind($output->getStream()); @@ -61,6 +64,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase } $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $question->setMaxAttempts(1); $question->setMultiselect(true); $this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); @@ -68,11 +72,13 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1'); + $question->setMaxAttempts(1); $question->setMultiselect(true); $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 '); + $question->setMaxAttempts(1); $question->setMultiselect(true); $this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question)); @@ -227,6 +233,7 @@ class QuestionHelperTest extends \PHPUnit_Framework_TestCase $dialog->setHelperSet($helperSet); $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices); + $question->setMaxAttempts(1); $answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question); $this->assertSame($expectedValue, $answer); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 3818ed719b..265f04884c 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -596,4 +596,8 @@ class Container implements IntrospectableContainerInterface { return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.'))); } + + private function __clone() + { + } } diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 78790be98b..55e47978cd 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -49,7 +49,7 @@ class XmlFileLoader extends FileLoader $this->parseImports($xml, $path); // parameters - $this->parseParameters($xml, $path); + $this->parseParameters($xml); // extensions $this->loadFromExtensions($xml); @@ -70,9 +70,8 @@ class XmlFileLoader extends FileLoader * Parses parameters. * * @param \DOMDocument $xml - * @param string $file */ - private function parseParameters(\DOMDocument $xml, $file) + private function parseParameters(\DOMDocument $xml) { if ($parameters = $this->getChildren($xml->documentElement, 'parameters')) { $this->container->getParameterBag()->add($this->getArgumentsAsPhp($parameters[0], 'parameter')); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index 999dd5a0c1..96db349185 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -650,6 +650,16 @@ class ContainerTest extends \PHPUnit_Framework_TestCase $this->assertTrue($c->has('alias')); $this->assertSame($c->get('alias'), $c->get('bar')); } + + public function testThatCloningIsNotSupported() + { + $class = new \ReflectionClass('Symfony\Component\DependencyInjection\Container'); + $clone = $class->getMethod('__clone'); + if (PHP_VERSION_ID >= 540000) { + $this->assertFalse($class->isCloneable()); + } + $this->assertTrue($clone->isPrivate()); + } } class ProjectServiceContainer extends Container diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php index 255b2a0b9c..b34b4bb863 100644 --- a/src/Symfony/Component/Form/ButtonBuilder.php +++ b/src/Symfony/Component/Form/ButtonBuilder.php @@ -498,7 +498,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface */ public function setRequestHandler(RequestHandlerInterface $requestHandler) { - throw new BadMethodCallException('Buttons do not support form processors.'); + throw new BadMethodCallException('Buttons do not support request handlers.'); } /** diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 7c4afb03bd..c6d1e31ab3 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -224,13 +224,13 @@ class Request /** * Constructor. * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * @param string $content The raw body data + * @param array $query The GET parameters + * @param array $request The POST parameters + * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) + * @param array $cookies The COOKIE parameters + * @param array $files The FILES parameters + * @param array $server The SERVER parameters + * @param string|resource $content The raw body data * * @api */ @@ -244,13 +244,13 @@ class Request * * This method also re-initializes all properties. * - * @param array $query The GET parameters - * @param array $request The POST parameters - * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) - * @param array $cookies The COOKIE parameters - * @param array $files The FILES parameters - * @param array $server The SERVER parameters - * @param string $content The raw body data + * @param array $query The GET parameters + * @param array $request The POST parameters + * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...) + * @param array $cookies The COOKIE parameters + * @param array $files The FILES parameters + * @param array $server The SERVER parameters + * @param string|resource $content The raw body data * * @api */ @@ -1563,16 +1563,38 @@ class Request */ public function getContent($asResource = false) { - if (PHP_VERSION_ID < 50600 && (false === $this->content || (true === $asResource && null !== $this->content))) { + $currentContentIsResource = is_resource($this->content); + if (PHP_VERSION_ID < 50600 && false === $this->content) { throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.'); } if (true === $asResource) { + if ($currentContentIsResource) { + rewind($this->content); + + return $this->content; + } + + // Content passed in parameter (test) + if (is_string($this->content)) { + $resource = fopen('php://temp','r+'); + fwrite($resource, $this->content); + rewind($resource); + + return $resource; + } + $this->content = false; return fopen('php://input', 'rb'); } + if ($currentContentIsResource) { + rewind($this->content); + + return stream_get_contents($this->content); + } + if (null === $this->content) { $this->content = file_get_contents('php://input'); } @@ -1902,7 +1924,8 @@ class Request $requestUri = substr($requestUri, 0, $pos); } - if (null !== $baseUrl && false === $pathInfo = substr($requestUri, strlen($baseUrl))) { + $pathInfo = substr($requestUri, strlen($baseUrl)); + if (null !== $baseUrl && (false === $pathInfo || '' === $pathInfo)) { // If substr() returns false then PATH_INFO is set to an empty string return '/'; } elseif (null === $baseUrl) { diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index c641cf62de..9f8c7ef292 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -1247,7 +1247,7 @@ class Response { $status = ob_get_status(true); $level = count($status); - $flags = PHP_VERSION_ID >= 50400 ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1; + $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1; while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) { if ($flush) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 45574df4c4..ed46999e87 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -969,6 +969,26 @@ class RequestTest extends \PHPUnit_Framework_TestCase $this->assertTrue(feof($retval)); } + public function testGetContentReturnsResourceWhenContentSetInConstructor() + { + $req = new Request(array(), array(), array(), array(), array(), array(), 'MyContent'); + $resource = $req->getContent(true); + + $this->assertTrue(is_resource($resource)); + $this->assertEquals('MyContent', stream_get_contents($resource)); + } + + public function testContentAsResource() + { + $resource = fopen('php://memory','r+'); + fwrite($resource, 'My other content'); + rewind($resource); + + $req = new Request(array(), array(), array(), array(), array(), array(), $resource); + $this->assertEquals('My other content', stream_get_contents($req->getContent(true))); + $this->assertEquals('My other content', $req->getContent()); + } + /** * @expectedException \LogicException * @dataProvider getContentCantBeCalledTwiceWithResourcesProvider @@ -1013,7 +1033,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase return array( 'Resource then fetch' => array(true, false), 'Resource then resource' => array(true, true), - 'Fetch then resource' => array(false, true), ); } diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index a6ee7c07b2..b68d0c2ad8 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -88,7 +88,7 @@ class PropertyAccessor implements PropertyAccessorInterface $this->writeProperty($objectOrArray, $property, $value); } - if ($propertyValues[$i][self::IS_REF]) { + if ($propertyValues[$i][self::IS_REF] && is_object($objectOrArray)) { return; } @@ -149,7 +149,7 @@ class PropertyAccessor implements PropertyAccessorInterface } } - if ($propertyValues[$i][self::IS_REF]) { + if ($propertyValues[$i][self::IS_REF] && is_object($objectOrArray)) { return true; } } diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassIsWritable.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassIsWritable.php new file mode 100644 index 0000000000..d07c7c0fa8 --- /dev/null +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassIsWritable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Tests\Fixtures; + +class TestClassIsWritable +{ + protected $value; + + public function getValue() + { + return $this->value; + } + + public function __construct($value) + { + $this->value = $value; + } +} \ No newline at end of file diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassSetValue.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassSetValue.php new file mode 100644 index 0000000000..638afee6af --- /dev/null +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassSetValue.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\PropertyAccess\Tests\Fixtures; + +class TestClassSetValue +{ + protected $value; + + public function getValue() + { + return $this->value; + } + + public function setValue($value) + { + $this->value = $value; + } + + public function __construct($value) + { + $this->value = $value; + } +} \ No newline at end of file diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php index 6fe2d2dfbf..a9f7834305 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php @@ -16,6 +16,8 @@ use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClass; use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall; use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicGet; use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object; +use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassSetValue; +use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassIsWritable; class PropertyAccessorTest extends \PHPUnit_Framework_TestCase { @@ -446,4 +448,45 @@ class PropertyAccessorTest extends \PHPUnit_Framework_TestCase $this->propertyAccessor->setValue($obj, 'publicProperty[foo][bar]', 'Updated'); $this->assertSame('Updated', $obj->publicProperty['foo']['bar']); } -} + + public function getReferenceChainObjectsForSetValue() + { + return array( + array(array('a' => array('b' => array('c' => 'old-value'))), '[a][b][c]', 'new-value'), + array(new TestClassSetValue(new TestClassSetValue('old-value')), 'value.value', 'new-value'), + array(new TestClassSetValue(array('a' => array('b' => array('c' => new TestClassSetValue('old-value'))))), 'value[a][b][c].value', 'new-value'), + array(new TestClassSetValue(array('a' => array('b' => 'old-value'))), 'value[a][b]', 'new-value'), + array(new \ArrayIterator(array('a' => array('b' => array('c' => 'old-value')))), '[a][b][c]', 'new-value'), + ); + + } + + /** + * @dataProvider getReferenceChainObjectsForSetValue + */ + public function testSetValueForReferenceChainIssue($object, $path, $value) + { + $this->propertyAccessor->setValue($object, $path, $value); + + $this->assertEquals($value, $this->propertyAccessor->getValue($object, $path)); + } + + public function getReferenceChainObjectsForIsWritable() + { + return array( + array(new TestClassIsWritable(array('a' => array('b' => 'old-value'))), 'value[a][b]', false), + array(new TestClassIsWritable(new \ArrayIterator(array('a' => array('b' => 'old-value')))), 'value[a][b]', true), + array(new TestClassIsWritable(array('a' => array('b' => array('c' => new TestClassSetValue('old-value'))))), 'value[a][b][c].value', true), + ); + + } + + /** + * @dataProvider getReferenceChainObjectsForIsWritable + */ + public function testIsWritableForReferenceChainIssue($object, $path, $value) + { + $this->assertEquals($value, $this->propertyAccessor->isWritable($object, $path)); + } + +} \ No newline at end of file diff --git a/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php b/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php index 3bf277f364..ea17c635d5 100644 --- a/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php +++ b/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php @@ -36,7 +36,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface */ public function __construct($username, $class) { - if (empty($username)) { + if ('' === $username || null === $username) { throw new \InvalidArgumentException('$username must not be empty.'); } if (empty($class)) { diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php index ded53e40b1..26740883cf 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php @@ -62,7 +62,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter } $username = $token->getUsername(); - if (empty($username)) { + if ('' === $username || null === $username) { $username = 'NONE_PROVIDED'; } diff --git a/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php b/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php index 92fcb4f2f7..d85572d0e0 100644 --- a/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php @@ -40,7 +40,7 @@ final class PersistentToken implements PersistentTokenInterface if (empty($class)) { throw new \InvalidArgumentException('$class must not be empty.'); } - if (empty($username)) { + if ('' === $username || null === $username) { throw new \InvalidArgumentException('$username must not be empty.'); } if (empty($series)) { diff --git a/src/Symfony/Component/Security/Core/User/User.php b/src/Symfony/Component/Security/Core/User/User.php index d458b72d5a..bc81f7ffa7 100644 --- a/src/Symfony/Component/Security/Core/User/User.php +++ b/src/Symfony/Component/Security/Core/User/User.php @@ -30,7 +30,7 @@ final class User implements AdvancedUserInterface public function __construct($username, $password, array $roles = array(), $enabled = true, $userNonExpired = true, $credentialsNonExpired = true, $userNonLocked = true) { - if (empty($username)) { + if ('' === $username || null === $username) { throw new \InvalidArgumentException('The username cannot be empty.'); } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index 2e1405f120..8d60331450 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -223,19 +223,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N */ protected function prepareForDenormalization($data) { - if (is_array($data) || is_object($data) && $data instanceof \ArrayAccess) { - $normalizedData = $data; - } elseif (is_object($data)) { - $normalizedData = array(); - - foreach ($data as $attribute => $value) { - $normalizedData[$attribute] = $value; - } - } else { - $normalizedData = array(); - } - - return $normalizedData; + return (array) $data; } /** diff --git a/src/Symfony/Component/Serializer/composer.json b/src/Symfony/Component/Serializer/composer.json index a140dada04..2c2497cdd7 100644 --- a/src/Symfony/Component/Serializer/composer.json +++ b/src/Symfony/Component/Serializer/composer.json @@ -22,7 +22,7 @@ "symfony/phpunit-bridge": "~2.8|~3.0", "symfony/yaml": "~2.8|~3.0", "symfony/config": "~2.8|~3.0", - "symfony/property-access": "~2.8|~3.0.0", + "symfony/property-access": "~2.8|~3.0", "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0" },