Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ addons:
- language-pack-fr-base
- ldap-utils
- slapd
- libsasl2-dev

env:
global:
Expand All @@ -23,10 +24,10 @@ matrix:
sudo: required
group: edge
- php: 5.5
env: php_extra="5.6 7.0"
- php: 7.1
env: deps=high
env: php_extra="5.6 7.0 7.1"
- php: 7.2
env: deps=high
- php: 7.3
env: deps=low
fast_finish: true

Expand All @@ -43,6 +44,12 @@ services:
- docker

before_install:
- |
# Enable Sury ppa
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update

- |
# Start Redis cluster
docker pull grokzen/redis-cluster:4.0.8
Expand Down Expand Up @@ -149,7 +156,6 @@ before_install:
echo hhvm.jit = 0 >> $INI
echo apc.enable_cli = 1 >> $INI
echo extension = redis.so >> $INI
echo extension = memcached.so >> $INI
if [[ $PHP = 5.* ]]; then
echo extension = memcache.so >> $INI
echo extension = mongo.so >> $INI
Expand All @@ -174,15 +180,38 @@ before_install:
elif [[ $PHP = 7.* ]]; then
if ! php --ri sodium > /dev/null; then
# install libsodium
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -q
sudo apt-get install libsodium-dev -y
tfold ext.libsodium tpecl libsodium sodium.so $INI
fi

tfold ext.apcu tpecl apcu-5.1.6 apcu.so $INI
tfold ext.apcu tpecl apcu-5.1.16 apcu.so $INI
tfold ext.mongodb tpecl mongodb-1.6.0alpha1 mongodb.so $INI
fi

if [[ $PHP == 7.3 ]]; then
# System libmemcached is missing sasl
LIBMEMCACHED_VERSION=1.0.18
wget "https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VERSION}/+download/libmemcached-${LIBMEMCACHED_VERSION}.tar.gz" -O libmemcached-${LIBMEMCACHED_VERSION}.tar.gz
tar xvfz libmemcached-${LIBMEMCACHED_VERSION}.tar.gz
cd "libmemcached-${LIBMEMCACHED_VERSION}"
mkdir -p /opt/libmemcached/${LIBMEMCACHED_VERSION}
./configure --prefix="/opt/libmemcached/${LIBMEMCACHED_VERSION}" LDFLAGS="-lpthread"
make
make install
cd -

EXTMEMCACHED_VERSION=3.1.3
wget https://pecl.php.net/get/memcached-${EXTMEMCACHED_VERSION}.tgz
tar xzvf memcached-${EXTMEMCACHED_VERSION}.tgz
cd memcached-${EXTMEMCACHED_VERSION}
phpize
./configure --with-libmemcached-dir=/opt/libmemcached/${LIBMEMCACHED_VERSION}
make
sudo make install
cd -
fi

echo extension = memcached.so >> $INI
done

- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ protected function tearDown()
$this->form = null;
}

protected function getBuilder($name = 'name')
protected function getBuilder()
{
return new FormBuilder($name, null, $this->dispatcher, $this->factory);
return new FormBuilder('name', null, $this->dispatcher, $this->factory);
}

protected function getForm($name = 'name')
protected function getForm()
{
return $this->getBuilder($name)
return $this->getBuilder()
->setData($this->collection)
->addEventSubscriber(new MergeDoctrineCollectionListener())
->getForm();
Expand Down Expand Up @@ -84,7 +84,7 @@ public function testOnSubmitNullClearCollection()
*/
public function testLegacyChildClassOnSubmitCallParent()
{
$form = $this->getBuilder('name')
$form = $this->getBuilder()
->setData($this->collection)
->addEventSubscriber(new TestClassExtendingMergeDoctrineCollectionListener())
->getForm();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\JsonResponse;
Expand Down Expand Up @@ -486,7 +487,8 @@ public function testCreateNotFoundException()

public function testCreateForm()
{
$form = $this->getMockBuilder('Symfony\Component\Form\FormInterface')->getMock();
$config = $this->getMockBuilder('Symfony\Component\Form\FormConfigInterface')->getMock();
$form = new Form($config);

$formFactory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$formFactory->expects($this->once())->method('create')->willReturn($form);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private function parseFileToDOM($file)
try {
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
} catch (\InvalidArgumentException $e) {
throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e);
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s', $file, $e->getMessage()), $e->getCode(), $e);
}

$this->validateExtensions($dom, $file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ protected function loadFile($file)
try {
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
} catch (ParseException $e) {
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e);
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s', $file, $e->getMessage()), 0, $e);
} finally {
restore_error_handler();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testParseFile()
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
} catch (\Exception $e) {
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');

$e = $e->getPrevious();
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
Expand All @@ -81,7 +81,7 @@ public function testParseFile()
$this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
} catch (\Exception $e) {
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file');

$e = $e->getPrevious();
$this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD');
Expand Down Expand Up @@ -437,7 +437,7 @@ public function testExtensions()
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
} catch (\Exception $e) {
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');

$e = $e->getPrevious();
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
Expand Down Expand Up @@ -477,7 +477,7 @@ public function testExtensionInPhar()
$this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
} catch (\Exception $e) {
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');

$e = $e->getPrevious();
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD');
Expand Down Expand Up @@ -528,7 +528,7 @@ public function testDocTypeIsNotAllowed()
$this->fail('->load() throws an InvalidArgumentException if the configuration contains a document type');
} catch (\Exception $e) {
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');
$this->assertRegExp(sprintf('#^Unable to parse file ".+%s": .+.$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type');

$e = $e->getPrevious();
$this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type');
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Dotenv/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private function lexVarname()
}

if (' ' === $this->data[$this->cursor] || "\t" === $this->data[$this->cursor]) {
throw $this->createFormatException('Whitespace are not supported after the variable name');
throw $this->createFormatException('Whitespace characters are not supported after the variable name');
}

if ('=' !== $this->data[$this->cursor]) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Dotenv/Tests/DotenvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getEnvDataWithFormatErrors()
{
$tests = [
['FOO=BAR BAZ', "A value containing spaces must be surrounded by quotes in \".env\" at line 1.\n...FOO=BAR BAZ...\n ^ line 1 offset 11"],
['FOO BAR=BAR', "Whitespace are not supported after the variable name in \".env\" at line 1.\n...FOO BAR=BAR...\n ^ line 1 offset 3"],
['FOO BAR=BAR', "Whitespace characters are not supported after the variable name in \".env\" at line 1.\n...FOO BAR=BAR...\n ^ line 1 offset 3"],
['FOO', "Missing = in the environment variable declaration in \".env\" at line 1.\n...FOO...\n ^ line 1 offset 3"],
['FOO="foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO=\"foo...\n ^ line 1 offset 8"],
['FOO=\'foo', "Missing quote to end the value in \".env\" at line 1.\n...FOO='foo...\n ^ line 1 offset 8"],
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
* Creates a new form builder.
*
* @param string $name
* @param string $dataClass
* @param string|null $dataClass
* @param EventDispatcherInterface $dispatcher
* @param FormFactoryInterface $factory
* @param array $options
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/ResolvedFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function getOptionsResolver()
* Override this method if you want to customize the builder class.
*
* @param string $name The name of the builder
* @param string $dataClass The data class
* @param string|null $dataClass The data class
* @param FormFactoryInterface $factory The current form factory
* @param array $options The builder options
*
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Test/TypeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp()
parent::setUp();

$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
$this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
}

protected function tearDown()
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Tests/AbstractFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract protected function createForm();
/**
* @param string $name
* @param EventDispatcherInterface $dispatcher
* @param string $dataClass
* @param string|null $dataClass
* @param array $options
*
* @return FormBuilder
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Form/Tests/ButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public function testSetParentOnSubmittedButton()

$button->submit('');

$button->setParent($this->getFormBuilder('form')->getForm());
$button->setParent($this->getFormBuilder()->getForm());
}

/**
* @dataProvider getDisabledStates
*/
public function testDisabledIfParentIsDisabled($parentDisabled, $buttonDisabled, $result)
{
$form = $this->getFormBuilder('form')
$form = $this->getFormBuilder()
->setDisabled($parentDisabled)
->getForm()
;
Expand Down Expand Up @@ -80,8 +80,8 @@ private function getButtonBuilder($name)
return new ButtonBuilder($name);
}

private function getFormBuilder($name)
private function getFormBuilder()
{
return new FormBuilder($name, null, $this->dispatcher, $this->factory);
return new FormBuilder('form', null, $this->dispatcher, $this->factory);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function setUp()
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
$this->tokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
$this->form = $this->getBuilder('post')
$this->form = $this->getBuilder()
->setDataMapper($this->getDataMapper())
->getForm();
}
Expand All @@ -41,14 +41,9 @@ protected function tearDown()
$this->form = null;
}

protected function getBuilder($name = 'name')
protected function getBuilder()
{
return new FormBuilder($name, null, $this->dispatcher, $this->factory, ['compound' => true]);
}

protected function getForm($name = 'name')
{
return $this->getBuilder($name)->getForm();
return new FormBuilder('post', null, $this->dispatcher, $this->factory, ['compound' => true]);
}

protected function getDataMapper()
Expand Down
12 changes: 0 additions & 12 deletions src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Form\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormTypeExtensionInterface;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\Form\ResolvedFormType;
Expand Down Expand Up @@ -380,15 +379,4 @@ private function getMockFormFactory()
{
return $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
}

/**
* @param string $name
* @param array $options
*
* @return FormBuilder
*/
protected function getBuilder($name = 'name', array $options = [])
{
return new FormBuilder($name, null, $this->dispatcher, $this->factory, $options);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Symfony\Component\HttpKernel\EventListener\ProfilerListener;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\Profiler\Profile;

class ProfilerListenerTest extends TestCase
{
Expand All @@ -27,9 +28,7 @@ class ProfilerListenerTest extends TestCase
*/
public function testKernelTerminate()
{
$profile = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile')
->disableOriginalConstructor()
->getMock();
$profile = new Profile('token');

$profiler = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler')
->disableOriginalConstructor()
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php": "^5.5.9|>=7.0.8",
"symfony/event-dispatcher": "~2.8|~3.0|~4.0",
"symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1",
"symfony/debug": "~2.8|~3.0|~4.0",
"symfony/debug": "^3.3.3|~4.0",
"symfony/polyfill-ctype": "~1.8",
"psr/log": "~1.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public function encodePassword($raw, $salt)
*/
public function isPasswordValid($encoded, $raw, $salt)
{
if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I')) {
// If $encoded was created via "sodium_crypto_pwhash_str()", the hashing algorithm may be "argon2id" instead of "argon2i".
// In this case, "password_verify()" cannot be used.
if (\PHP_VERSION_ID >= 70200 && \defined('PASSWORD_ARGON2I') && (false === strpos($encoded, '$argon2id$'))) {
return !$this->isPasswordTooLong($raw) && password_verify($raw, $encoded);
}
if (\function_exists('sodium_crypto_pwhash_str_verify')) {
Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/Security/Core/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

/**
* Helper class for commonly-needed security tasks.
*
* @final
*/
final class Security
class Security
{
const ACCESS_DENIED_ERROR = '_security.403_error';
const AUTHENTICATION_ERROR = '_security.last_error';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This template is used for translation message extraction tests
<?php echo $view['translator']->trans('single-quoted key'); ?>
<?php echo $view['translator']->trans('double-quoted key'); ?>
<?php echo $view['translator']->trans(<<<'EOF'
<?php echo $view['translator']->trans(<<<EOF
heredoc key
EOF
); ?>
Expand Down