Merge branch '2.3' into 2.7
* 2.3: Detect Mintty for color support on Windows Add a group for tests of the finder against the FTP server Fix license headers Forbid serializing a Crawler Fix phpdoc block of NativeSessionStorage class Added exception when setAutoInitialize is called when locked [FrameworkBundle] Advanced search templates of bundles [Security] Allow user providers to be defined in many files Use random_bytes function if it is available for random number generation
This commit is contained in:
commit
3ba54c1c31
@ -97,8 +97,12 @@ class TemplateFinder implements TemplateFinderInterface
|
|||||||
*/
|
*/
|
||||||
private function findTemplatesInBundle(BundleInterface $bundle)
|
private function findTemplatesInBundle(BundleInterface $bundle)
|
||||||
{
|
{
|
||||||
$templates = $this->findTemplatesInFolder($bundle->getPath().'/Resources/views');
|
|
||||||
$name = $bundle->getName();
|
$name = $bundle->getName();
|
||||||
|
$templates = array_merge(
|
||||||
|
$this->findTemplatesInFolder($bundle->getPath().'/Resources/views'),
|
||||||
|
$this->findTemplatesInFolder($this->rootDir.'/'.$name.'/views')
|
||||||
|
);
|
||||||
|
$templates = array_unique($templates);
|
||||||
|
|
||||||
foreach ($templates as $i => $template) {
|
foreach ($templates as $i => $template) {
|
||||||
$templates[$i] = $template->set('bundle', $name);
|
$templates[$i] = $template->set('bundle', $name);
|
||||||
|
@ -46,10 +46,11 @@ class TemplateFinderTest extends TestCase
|
|||||||
$finder->findAllTemplates()
|
$finder->findAllTemplates()
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertCount(6, $templates, '->findAllTemplates() find all templates in the bundles and global folders');
|
$this->assertCount(7, $templates, '->findAllTemplates() find all templates in the bundles and global folders');
|
||||||
$this->assertContains('BaseBundle::base.format.engine', $templates);
|
$this->assertContains('BaseBundle::base.format.engine', $templates);
|
||||||
$this->assertContains('BaseBundle::this.is.a.template.format.engine', $templates);
|
$this->assertContains('BaseBundle::this.is.a.template.format.engine', $templates);
|
||||||
$this->assertContains('BaseBundle:controller:base.format.engine', $templates);
|
$this->assertContains('BaseBundle:controller:base.format.engine', $templates);
|
||||||
|
$this->assertContains('BaseBundle:controller:custom.format.engine', $templates);
|
||||||
$this->assertContains('::this.is.a.template.format.engine', $templates);
|
$this->assertContains('::this.is.a.template.format.engine', $templates);
|
||||||
$this->assertContains('::resource.format.engine', $templates);
|
$this->assertContains('::resource.format.engine', $templates);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle;
|
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle;
|
||||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle;
|
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle;
|
||||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle;
|
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle;
|
||||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||||
|
|
||||||
|
@ -357,7 +357,6 @@ class MainConfiguration implements ConfigurationInterface
|
|||||||
),
|
),
|
||||||
'my_entity_provider' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')),
|
'my_entity_provider' => array('entity' => array('class' => 'SecurityBundle:User', 'property' => 'username')),
|
||||||
))
|
))
|
||||||
->disallowNewKeysInSubsequentConfigs()
|
|
||||||
->isRequired()
|
->isRequired()
|
||||||
->requiresAtLeastOneElement()
|
->requiresAtLeastOneElement()
|
||||||
->useAttributeAsKey('name')
|
->useAttributeAsKey('name')
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Symfony\Bundle\SecurityBundle\Tests\DataCollector;
|
namespace Symfony\Bundle\SecurityBundle\Tests\DataCollector;
|
||||||
|
|
||||||
use Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector;
|
use Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector;
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
||||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
||||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\FormLoginBundle;
|
use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FormLoginBundle\FormLoginBundle;
|
||||||
use Symfony\Bundle\TwigBundle\TwigBundle;
|
use Symfony\Bundle\TwigBundle\TwigBundle;
|
||||||
use Symfony\Bundle\SecurityBundle\SecurityBundle;
|
use Symfony\Bundle\SecurityBundle\SecurityBundle;
|
||||||
|
@ -87,7 +87,7 @@ class StreamOutput extends Output
|
|||||||
*
|
*
|
||||||
* Colorization is disabled if not supported by the stream:
|
* Colorization is disabled if not supported by the stream:
|
||||||
*
|
*
|
||||||
* - Windows without Ansicon and ConEmu
|
* - Windows without Ansicon, ConEmu or Mintty
|
||||||
* - non tty consoles
|
* - non tty consoles
|
||||||
*
|
*
|
||||||
* @return bool true if the stream supports colorization, false otherwise
|
* @return bool true if the stream supports colorization, false otherwise
|
||||||
@ -95,7 +95,7 @@ class StreamOutput extends Output
|
|||||||
protected function hasColorSupport()
|
protected function hasColorSupport()
|
||||||
{
|
{
|
||||||
if (DIRECTORY_SEPARATOR === '\\') {
|
if (DIRECTORY_SEPARATOR === '\\') {
|
||||||
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
|
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM');
|
||||||
}
|
}
|
||||||
|
|
||||||
return function_exists('posix_isatty') && @posix_isatty($this->stream);
|
return function_exists('posix_isatty') && @posix_isatty($this->stream);
|
||||||
|
@ -325,6 +325,17 @@ class Crawler extends \SplObjectStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Serializing and unserializing a crawler creates DOM objects in a corrupted state. DOM elements are not properly serializable.
|
||||||
|
public function unserialize($serialized)
|
||||||
|
{
|
||||||
|
throw new \BadMethodCallException('A Crawler cannot be serialized.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function serialize()
|
||||||
|
{
|
||||||
|
throw new \BadMethodCallException('A Crawler cannot be serialized.');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a node given its position in the node list.
|
* Returns a node given its position in the node list.
|
||||||
*
|
*
|
||||||
|
@ -16,42 +16,36 @@ use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
|
|||||||
class RecursiveDirectoryIteratorTest extends IteratorTestCase
|
class RecursiveDirectoryIteratorTest extends IteratorTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @dataProvider getPaths
|
* @group network
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @param bool $seekable
|
|
||||||
* @param array $contains
|
|
||||||
* @param string $message
|
|
||||||
*/
|
*/
|
||||||
public function testRewind($path, $seekable, $contains, $message = null)
|
public function testRewindOnFtp()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
|
$i = new RecursiveDirectoryIterator('ftp://ftp.mozilla.org/', \RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
} catch (\UnexpectedValueException $e) {
|
} catch (\UnexpectedValueException $e) {
|
||||||
$this->markTestSkipped(sprintf('Unsupported stream "%s".', $path));
|
$this->markTestSkipped('Unsupported stream "ftp".');
|
||||||
}
|
}
|
||||||
|
|
||||||
$i->rewind();
|
$i->rewind();
|
||||||
|
|
||||||
$this->assertTrue(true, $message);
|
$this->assertTrue(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider getPaths
|
* @group network
|
||||||
*
|
|
||||||
* @param string $path
|
|
||||||
* @param bool $seekable
|
|
||||||
* @param array $contains
|
|
||||||
* @param string $message
|
|
||||||
*/
|
*/
|
||||||
public function testSeek($path, $seekable, $contains, $message = null)
|
public function testSeekOnFtp()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
|
$i = new RecursiveDirectoryIterator('ftp://ftp.mozilla.org/', \RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
} catch (\UnexpectedValueException $e) {
|
} catch (\UnexpectedValueException $e) {
|
||||||
$this->markTestSkipped(sprintf('Unsupported stream "%s".', $path));
|
$this->markTestSkipped('Unsupported stream "ftp".');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$contains = array(
|
||||||
|
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README',
|
||||||
|
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub',
|
||||||
|
);
|
||||||
$actual = array();
|
$actual = array();
|
||||||
|
|
||||||
$i->seek(0);
|
$i->seek(0);
|
||||||
@ -62,18 +56,4 @@ class RecursiveDirectoryIteratorTest extends IteratorTestCase
|
|||||||
|
|
||||||
$this->assertEquals($contains, $actual);
|
$this->assertEquals($contains, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPaths()
|
|
||||||
{
|
|
||||||
$data = array();
|
|
||||||
|
|
||||||
// ftp
|
|
||||||
$contains = array(
|
|
||||||
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README',
|
|
||||||
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub',
|
|
||||||
);
|
|
||||||
$data[] = array('ftp://ftp.mozilla.org/', false, $contains);
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -854,6 +854,10 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
*/
|
*/
|
||||||
public function setAutoInitialize($initialize)
|
public function setAutoInitialize($initialize)
|
||||||
{
|
{
|
||||||
|
if ($this->locked) {
|
||||||
|
throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
|
||||||
|
}
|
||||||
|
|
||||||
$this->autoInitialize = (bool) $initialize;
|
$this->autoInitialize = (bool) $initialize;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Symfony package.
|
* This file is part of the Symfony package.
|
||||||
*
|
*
|
||||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Symfony package.
|
* This file is part of the Symfony package.
|
||||||
*
|
*
|
||||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Symfony package.
|
* This file is part of the Symfony package.
|
||||||
*
|
*
|
||||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Symfony package.
|
* This file is part of the Symfony package.
|
||||||
*
|
*
|
||||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Symfony package.
|
* This file is part of the Symfony package.
|
||||||
*
|
*
|
||||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@ -65,7 +65,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
* ("auto_start", is not supported as it tells PHP to start a session before
|
* ("auto_start", is not supported as it tells PHP to start a session before
|
||||||
* PHP starts to execute user-land code. Setting during runtime has no effect).
|
* PHP starts to execute user-land code. Setting during runtime has no effect).
|
||||||
*
|
*
|
||||||
* cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely).
|
* cache_limiter, "" (use "0" to prevent headers from being sent entirely).
|
||||||
* cookie_domain, ""
|
* cookie_domain, ""
|
||||||
* cookie_httponly, ""
|
* cookie_httponly, ""
|
||||||
* cookie_lifetime, "0"
|
* cookie_lifetime, "0"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Symfony package.
|
* This file is part of the Symfony package.
|
||||||
*
|
*
|
||||||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a PHP script that can be stopped only with a SIGKILL (9) signal for 3 seconds.
|
* Runs a PHP script that can be stopped only with a SIGKILL (9) signal for 3 seconds.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
define('ERR_SELECT_FAILED', 1);
|
define('ERR_SELECT_FAILED', 1);
|
||||||
define('ERR_TIMEOUT', 2);
|
define('ERR_TIMEOUT', 2);
|
||||||
define('ERR_READ_FAILED', 3);
|
define('ERR_READ_FAILED', 3);
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
// required for signal handling
|
// required for signal handling
|
||||||
declare (ticks = 1);
|
declare (ticks = 1);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is new3 of the Symfony package.
|
* This file is part of the Symfony package.
|
||||||
*
|
*
|
||||||
* (c) Fabien Potencier <fabien@symfony.com>
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
*
|
*
|
||||||
|
@ -43,9 +43,9 @@ final class SecureRandom implements SecureRandomInterface
|
|||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
|
||||||
// determine whether to use OpenSSL
|
// determine whether to use OpenSSL
|
||||||
if (!function_exists('openssl_random_pseudo_bytes')) {
|
if (!function_exists('random_bytes') && !function_exists('openssl_random_pseudo_bytes')) {
|
||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
$this->logger->notice('It is recommended that you enable the "openssl" extension for random number generation.');
|
$this->logger->notice('It is recommended that you install the "paragonie/random_compat" library or enable the "openssl" extension for random number generation.');
|
||||||
}
|
}
|
||||||
$this->useOpenSsl = false;
|
$this->useOpenSsl = false;
|
||||||
} else {
|
} else {
|
||||||
@ -58,6 +58,10 @@ final class SecureRandom implements SecureRandomInterface
|
|||||||
*/
|
*/
|
||||||
public function nextBytes($nbBytes)
|
public function nextBytes($nbBytes)
|
||||||
{
|
{
|
||||||
|
if (function_exists('random_bytes')) {
|
||||||
|
return random_bytes($nbBytes);
|
||||||
|
}
|
||||||
|
|
||||||
// try OpenSSL
|
// try OpenSSL
|
||||||
if ($this->useOpenSsl) {
|
if ($this->useOpenSsl) {
|
||||||
$bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
|
$bytes = openssl_random_pseudo_bytes($nbBytes, $strong);
|
||||||
|
@ -42,11 +42,13 @@
|
|||||||
"suggest": {
|
"suggest": {
|
||||||
"symfony/class-loader": "For using the ACL generateSql script",
|
"symfony/class-loader": "For using the ACL generateSql script",
|
||||||
"symfony/finder": "For using the ACL generateSql script",
|
"symfony/finder": "For using the ACL generateSql script",
|
||||||
|
"symfony/form": "",
|
||||||
"symfony/validator": "For using the user password constraint",
|
"symfony/validator": "For using the user password constraint",
|
||||||
"symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs",
|
"symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs",
|
||||||
"doctrine/dbal": "For using the built-in ACL implementation",
|
"doctrine/dbal": "For using the built-in ACL implementation",
|
||||||
"symfony/expression-language": "For using the expression voter",
|
"symfony/expression-language": "For using the expression voter",
|
||||||
"ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5"
|
"ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5"
|
||||||
|
"paragonie/random_compat": ""
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": { "Symfony\\Component\\Security\\": "" }
|
"psr-4": { "Symfony\\Component\\Security\\": "" }
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\Validator\Tests\Mapping\Loader;
|
namespace Symfony\Component\Validator\Tests\Mapping\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||||
|
Reference in New Issue
Block a user