Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
* 3.0:
  [ClassLoader] Use symfony/polyfill-apcu
  [HttpFoundation][Cookie] Cookie DateTimeInterface fix
  bumped Symfony version to 2.8.3
  updated VERSION for 2.8.2
  updated CHANGELOG for 2.8.2
  bumped Symfony version to 2.7.10
  updated VERSION for 2.7.9
  updated CHANGELOG for 2.7.9
  bumped Symfony version to 2.3.38
  updated VERSION for 2.3.37
  update CONTRIBUTORS for 2.3.37
  updated CHANGELOG for 2.3.37
  added missing requirement
  removed obsolete tests, fixed composer.json
  do not ship with a custom rng implementation
  [Console] HHVM read input stream bug
  Fix max width for multibyte keys in choice question
  [Console] Display console application name even when no version set
  Remove calls to non-existing method
  Remove empty statements.
  • Loading branch information
nicolas-grekas committed Jan 15, 2016
2 parents d46ac31 + 5f41662 commit a4f3baa
Show file tree
Hide file tree
Showing 47 changed files with 499 additions and 1,158 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -36,9 +36,10 @@ before_install:
- echo session.gc_probability = 0 >> $INI_FILE
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi;
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi;
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE) || echo "Let's continue without apcu extension"; fi;
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi;
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi;
- if [[ $TRAVIS_PHP_VERSION = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi;
- if [[ $TRAVIS_PHP_VERSION = 5.* && ! $deps ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi;
- if [[ $TRAVIS_PHP_VERSION = 5.* ]]; then pecl install -f memcached-2.1.0; fi;
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
- if [[ $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer-auth.json ~/.composer/auth.json; fi;
Expand Down
32 changes: 19 additions & 13 deletions CONTRIBUTORS.md
Expand Up @@ -75,45 +75,45 @@ Symfony is the result of the work of many people who made the code better
- Arnaud Le Blanc (arnaud-lb)
- Tim Nagel (merk)
- Brice BERNARD (brikou)
- Graham Campbell (graham)
- Jérôme Tamarelle (gromnan)
- marc.weistroff
- Michal Piotrowski (eventhorizon)
- lenar
- Graham Campbell (graham)
- Włodzimierz Gajda (gajdaw)
- Michal Piotrowski (eventhorizon)
- Florian Voutzinos (florianv)
- Peter Rehm (rpet)
- Colin Frei
- Dariusz Ruminski
- Adrien Brault (adrienbrault)
- excelwebzone
- Jacob Dreesen (jdreesen)
- Dariusz Ruminski
- Peter Kokot (maastermedia)
- Fabien Pennequin (fabienpennequin)
- Pierre du Plessis (pierredup)
- Alexander Schwenn (xelaris)
- Gordon Franke (gimler)
- Iltar van der Berg (kjarli)
- Robert Schönthal (digitalkaoz)
- Jérémy DERUSSÉ (jderusse)
- Joshua Thijssen
- Stefano Sala (stefano.sala)
- David Buchmann (dbu)
- Issei Murasawa (issei_m)
- Iltar van der Berg (kjarli)
- Juti Noppornpitak (shiroyuki)
- Eric GELOEN (gelo)
- Sebastian Hörl (blogsh)
- Daniel Gomes (danielcsgomes)
- Hidenori Goto (hidenorigoto)
- Vladimir Reznichenko (kalessil)
- Guilherme Blanco (guilhermeblanco)
- Pablo Godel (pgodel)
- Vladimir Reznichenko (kalessil)
- Tigran Azatyan (tigranazatyan)
- Jérémie Augustin (jaugustin)
- Sebastiaan Stok (sstok)
- Rafael Dohms (rdohms)
- Arnaud Kleinpeter (nanocom)
- Alexander M. Turek (derrabus)
- Tigran Azatyan (tigranazatyan)
- Richard Shank (iampersistent)
- Charles Sarrazin (csarrazi)
- Clemens Tolboom
Expand Down Expand Up @@ -149,6 +149,7 @@ Symfony is the result of the work of many people who made the code better
- sun (sun)
- Larry Garfield (crell)
- Martin Schuhfuß (usefulthink)
- Jáchym Toušek
- Matthieu Bontemps (mbontemps)
- Pierre Minnieur (pminnieur)
- fivestar
Expand All @@ -166,7 +167,6 @@ Symfony is the result of the work of many people who made the code better
- Rui Marinho (ruimarinho)
- Julien Brochet (mewt)
- Sergey Linnik (linniksa)
- Jáchym Toušek
- Marcel Beerta (mazen)
- Vincent AUBERT (vincent)
- julien pauli (jpauli)
Expand All @@ -177,6 +177,7 @@ Symfony is the result of the work of many people who made the code better
- Elnur Abdurrakhimov (elnur)
- Manuel Reinhard (sprain)
- Danny Berger (dpb587)
- Diego Saint Esteben (dosten)
- Roman Marintšenko (inori)
- Xavier Montaña Carreras (xmontana)
- Chris Wilkinson (thewilkybarkid)
Expand Down Expand Up @@ -207,7 +208,6 @@ Symfony is the result of the work of many people who made the code better
- Ruben Gonzalez (rubenrua)
- Marcos Sánchez
- Kim Hemsø Rasmussen (kimhemsoe)
- Diego Saint Esteben (dosten)
- Tom Van Looy (tvlooy)
- Wouter Van Hecke
- Peter Kruithof (pkruithof)
Expand Down Expand Up @@ -237,6 +237,7 @@ Symfony is the result of the work of many people who made the code better
- Jan Decavele (jandc)
- Gustavo Piltcher
- Stepan Tanasiychuk (stfalcon)
- Titouan Galopin (tgalopin)
- Tiago Ribeiro (fixe)
- Bob den Otter (bopp)
- Adrian Rudnik (kreischweide)
Expand Down Expand Up @@ -321,6 +322,7 @@ Symfony is the result of the work of many people who made the code better
- Jan Schumann
- Niklas Fiekas
- Mark Challoner (markchalloner)
- Gregor Harlan (gharlan)
- Markus Bachmann (baachi)
- lancergr
- Olivier Dolbeau (odolbeau)
Expand All @@ -337,6 +339,7 @@ Symfony is the result of the work of many people who made the code better
- cedric lombardot (cedriclombardot)
- Jonas Flodén (flojon)
- Christian Schmidt
- Jakub Kucharovic (jkucharovic)
- Marcin Sikoń (marphi)
- Dominik Zogg (dominik.zogg)
- Mathieu Lemoine
Expand Down Expand Up @@ -396,7 +399,6 @@ Symfony is the result of the work of many people who made the code better
- MatTheCat
- John Bafford (jbafford)
- Denis Gorbachev (starfall)
- Titouan Galopin (tgalopin)
- Steven Surowiec
- Kevin Saliou (kbsali)
- Ryan
Expand Down Expand Up @@ -440,7 +442,6 @@ Symfony is the result of the work of many people who made the code better
- Wang Jingyu
- Åsmund Garfors
- Maxime Douailin
- Gregor Harlan
- Michael Hirschler (mvhirsch)
- Javier López (loalf)
- Reinier Kip
Expand All @@ -457,7 +458,6 @@ Symfony is the result of the work of many people who made the code better
- Tristan Maindron (tmaindron)
- Ke WANG (yktd26)
- Strate
- Jakub Kucharovic
- Miquel Rodríguez Telep (mrtorrent)
- Sergey Kolodyazhnyy (skolodyazhnyy)
- umpirski
Expand Down Expand Up @@ -507,6 +507,7 @@ Symfony is the result of the work of many people who made the code better
- Joshua Nye
- Dave Marshall (davedevelopment)
- avorobiev
- Gladhon
- Venu
- Lars Vierbergen
- Dennis Hotson
Expand Down Expand Up @@ -572,6 +573,7 @@ Symfony is the result of the work of many people who made the code better
- Aleksey Podskrebyshev
- Steffen Roßkamp
- David Marín Carreño (davefx)
- Hidde Boomsma (hboomsma)
- Jörn Lang (j.lang)
- mwsaz
- Benoît Bourgeois
Expand Down Expand Up @@ -615,6 +617,7 @@ Symfony is the result of the work of many people who made the code better
- Benoît Merlet (trompette)
- Koen Kuipers
- datibbaw
- Sébastien Santoro
- Raul Fraile (raulfraile)
- sensio
- Patrick Kaufmann
Expand Down Expand Up @@ -686,6 +689,7 @@ Symfony is the result of the work of many people who made the code better
- Max Beutel
- Michal Trojanowski
- Catalin Dan
- Mihai Stancu
- nacho
- Piotr Antosik (antek88)
- Artem Lopata
Expand All @@ -698,6 +702,7 @@ Symfony is the result of the work of many people who made the code better
- Max Grigorian (maxakawizard)
- benatespina (benatespina)
- Denis Kop
- EdgarPE
- jfcixmedia
- Martijn Evers
- Benjamin Paap (benjaminpaap)
Expand Down Expand Up @@ -980,6 +985,7 @@ Symfony is the result of the work of many people who made the code better
- Michal Gebauer
- Gleb Sidora
- David Stone
- Adrien Lucas (adrienlucas)
- Pablo Maria Martelletti (pmartelletti)
- Yassine Guedidi (yguedidi)
- Luis Muñoz
Expand Down Expand Up @@ -1056,6 +1062,7 @@ Symfony is the result of the work of many people who made the code better
- devel
- Trevor Suarez
- gedrox
- Mathieu MARCHOIS
- dropfen
- Andrey Chernykh
- Edvinas Klovas
Expand Down Expand Up @@ -1179,7 +1186,6 @@ Symfony is the result of the work of many people who made the code better
- srsbiz
- Taylan Kasap
- Nicolas A. Bérard-Nault
- Gladhon
- Saem Ghani
- Stefan Oderbolz
- Curtis
Expand Down Expand Up @@ -1233,6 +1239,7 @@ Symfony is the result of the work of many people who made the code better
- Eric J. Duran
- cmfcmf
- Drew Butler
- pawel-lewtak
- Steve Müller
- Andras Ratz
- andreabreu98
Expand Down Expand Up @@ -1260,7 +1267,6 @@ Symfony is the result of the work of many people who made the code better
- Pierre-Louis LAUNAY
- djama
- Eduardo Conceição
- Sébastien Santoro
- Jon Cave
- Sébastien HOUZE
- Abdulkadir N. A.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -20,6 +20,7 @@
"doctrine/common": "~2.4",
"twig/twig": "~1.23|~2.0",
"psr/log": "~1.0",
"symfony/polyfill-apcu": "~1.0,>=1.0.2",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php56": "~1.0",
Expand Down
Expand Up @@ -13,7 +13,7 @@

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;;
use Symfony\Component\DependencyInjection\Extension\Extension;

class FormLoginExtension extends Extension
{
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\Extension\Extension;;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/ClassLoader/ApcClassLoader.php
Expand Up @@ -67,8 +67,8 @@ class ApcClassLoader
*/
public function __construct($prefix, $decorated)
{
if (!extension_loaded('apc')) {
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.');
if (!function_exists('apcu_fetch')) {
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not installed.');
}

if (!method_exists($decorated, 'findFile')) {
Expand Down Expand Up @@ -122,8 +122,8 @@ public function loadClass($class)
*/
public function findFile($class)
{
if (false === $file = apc_fetch($this->prefix.$class)) {
apc_store($this->prefix.$class, $file = $this->decorated->findFile($class));
if (false === $file = apcu_fetch($this->prefix.$class)) {
apcu_store($this->prefix.$class, $file = $this->decorated->findFile($class));
}

return $file;
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php
Expand Up @@ -21,17 +21,17 @@ class ApcClassLoaderTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
apc_clear_cache('user');
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
$this->markTestSkipped('The apc extension is available, but not enabled.');
} else {
$this->markTestSkipped('APC is not enabled.');
apcu_clear_cache();
}
}

protected function tearDown()
{
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
apc_clear_cache('user');
apcu_clear_cache();
}
}

Expand All @@ -42,7 +42,7 @@ public function testConstructor()

$loader = new ApcClassLoader('test.prefix.', $loader);

$this->assertEquals($loader->findFile('\Apc\Namespaced\FooBar'), apc_fetch('test.prefix.\Apc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument');
$this->assertEquals($loader->findFile('\Apc\Namespaced\FooBar'), apcu_fetch('test.prefix.\Apc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument');
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/ClassLoader/composer.json
Expand Up @@ -17,7 +17,8 @@
],
"minimum-stability": "dev",
"require": {
"php": ">=5.5.9"
"php": ">=5.5.9",
"symfony/polyfill-apcu": "~1.0,>=1.0.2"
},
"require-dev": {
"symfony/finder": "~2.8|~3.0"
Expand Down
8 changes: 6 additions & 2 deletions src/Symfony/Component/Console/Application.php
Expand Up @@ -306,8 +306,12 @@ public function setVersion($version)
*/
public function getLongVersion()
{
if ('UNKNOWN' !== $this->getName() && 'UNKNOWN' !== $this->getVersion()) {
return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
if ('UNKNOWN' !== $this->getName()) {
if ('UNKNOWN' !== $this->getVersion()) {
return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
}

return sprintf('<info>%s</info>', $this->getName());
}

return '<info>Console Tool</info>';
Expand Down
7 changes: 4 additions & 3 deletions src/Symfony/Component/Console/Helper/QuestionHelper.php
Expand Up @@ -156,11 +156,12 @@ protected function writePrompt(OutputInterface $output, Question $question)
$message = $question->getQuestion();

if ($question instanceof ChoiceQuestion) {
$width = max(array_map('strlen', array_keys($question->getChoices())));
$maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));

$messages = (array) $question->getQuestion();
foreach ($question->getChoices() as $key => $value) {
$messages[] = sprintf(" [<info>%-${width}s</info>] %s", $key, $value);
$width = $maxWidth - $this->strlen($key);
$messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
}

$output->writeln($messages);
Expand Down Expand Up @@ -434,7 +435,7 @@ private function getShell()
private function readFromInput($stream)
{
if (STDIN === $stream && function_exists('readline')) {
$ret = readline();
$ret = readline('');
} else {
$ret = fgets($stream, 4096);
}
Expand Down
29 changes: 29 additions & 0 deletions src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Console\Tests\Helper;

use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\FormatterHelper;
Expand Down Expand Up @@ -350,6 +351,34 @@ public function testNoInteraction()
$this->assertEquals('not yet', $dialog->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question));
}

public function testChoiceOutputFormattingQuestionForUtf8Keys()
{
$question = 'Lorem ipsum?';
$possibleChoices = array(
'foo' => 'foo',
'żółw' => 'bar',
'łabądź' => 'baz',
);
$outputShown = array(
$question,
' [<info>foo </info>] foo',
' [<info>żółw </info>] bar',
' [<info>łabądź</info>] baz',
);
$output = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
$output->method('getFormatter')->willReturn(new OutputFormatter());

$dialog = new QuestionHelper();
$dialog->setInputStream($this->getInputStream("\n"));
$helperSet = new HelperSet(array(new FormatterHelper()));
$dialog->setHelperSet($helperSet);

$output->expects($this->once())->method('writeln')->with($this->equalTo($outputShown));

$question = new ChoiceQuestion($question, $possibleChoices, 'foo');
$dialog->ask($this->createInputInterfaceMock(), $output, $question);
}

protected function getInputStream($input)
{
$stream = fopen('php://memory', 'r+', false);
Expand Down

0 comments on commit a4f3baa

Please sign in to comment.