Merge branch '4.3' into 4.4
* 4.3: [Security/Http] fix typo in deprecation message Various tweaks 3.4 Various tweaks 4.3 [PhpUnit] Fix usleep mock return value [Lock] use Predis\ClientInterface instead of Predis\Client Fix version typo in deprecation notice Make legacy "wrong" RFC2047 encoding apply only to one header
This commit is contained in:
commit
51a2cb6e3c
@ -53,12 +53,10 @@ class ClockMock
|
||||
public static function usleep($us)
|
||||
{
|
||||
if (null === self::$now) {
|
||||
return \usleep($us);
|
||||
\usleep($us);
|
||||
} else {
|
||||
self::$now += $us / 1000000;
|
||||
}
|
||||
|
||||
self::$now += $us / 1000000;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function microtime($asFloat = false)
|
||||
@ -127,7 +125,7 @@ function sleep(\$s)
|
||||
|
||||
function usleep(\$us)
|
||||
{
|
||||
return \\$self::usleep(\$us);
|
||||
\\$self::usleep(\$us);
|
||||
}
|
||||
|
||||
function date(\$format, \$timestamp = null)
|
||||
|
@ -19,9 +19,9 @@ class RedisAdapter extends AbstractAdapter
|
||||
use RedisTrait;
|
||||
|
||||
/**
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient The redis client
|
||||
* @param string $namespace The default namespace
|
||||
* @param int $defaultLifetime The default lifetime
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient The redis client
|
||||
* @param string $namespace The default namespace
|
||||
* @param int $defaultLifetime The default lifetime
|
||||
*/
|
||||
public function __construct($redisClient, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
|
||||
{
|
||||
|
@ -68,9 +68,9 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
|
||||
private $redisServerSupportSPOP = null;
|
||||
|
||||
/**
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient The redis client
|
||||
* @param string $namespace The default namespace
|
||||
* @param int $defaultLifetime The default lifetime
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient The redis client
|
||||
* @param string $namespace The default namespace
|
||||
* @param int $defaultLifetime The default lifetime
|
||||
*
|
||||
* @throws \Symfony\Component\Cache\Exception\LogicException If phpredis with version lower than 3.1.3.
|
||||
*/
|
||||
@ -79,7 +79,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
|
||||
$this->init($redisClient, $namespace, $defaultLifetime, $marshaller);
|
||||
|
||||
// Make sure php-redis is 3.1.3 or higher configured for Redis classes
|
||||
if (!$this->redis instanceof Predis\Client && version_compare(phpversion('redis'), '3.1.3', '<')) {
|
||||
if (!$this->redis instanceof \Predis\ClientInterface && version_compare(phpversion('redis'), '3.1.3', '<')) {
|
||||
throw new LogicException('RedisTagAwareAdapter requires php-redis 3.1.3 or higher, alternatively use predis/predis');
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
|
||||
return true;
|
||||
}
|
||||
|
||||
$predisCluster = $this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof ClusterInterface;
|
||||
$predisCluster = $this->redis instanceof \Predis\ClientInterface && $this->redis->getConnection() instanceof ClusterInterface;
|
||||
$this->pipeline(static function () use ($ids, $tagData, $predisCluster) {
|
||||
if ($predisCluster) {
|
||||
foreach ($ids as $id) {
|
||||
|
@ -26,7 +26,7 @@ class RedisCache extends AbstractCache
|
||||
use RedisTrait;
|
||||
|
||||
/**
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient
|
||||
*/
|
||||
public function __construct($redisClient, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ trait RedisTrait
|
||||
private $marshaller;
|
||||
|
||||
/**
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient
|
||||
*/
|
||||
private function init($redisClient, string $namespace, int $defaultLifetime, ?MarshallerInterface $marshaller)
|
||||
{
|
||||
@ -55,8 +55,8 @@ trait RedisTrait
|
||||
if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) {
|
||||
throw new InvalidArgumentException(sprintf('RedisAdapter namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0]));
|
||||
}
|
||||
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\Client && !$redisClient instanceof RedisProxy && !$redisClient instanceof RedisClusterProxy) {
|
||||
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient)));
|
||||
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy && !$redisClient instanceof RedisClusterProxy) {
|
||||
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given.', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient)));
|
||||
}
|
||||
$this->redis = $redisClient;
|
||||
$this->marshaller = $marshaller ?? new DefaultMarshaller();
|
||||
@ -77,7 +77,7 @@ trait RedisTrait
|
||||
*
|
||||
* @throws InvalidArgumentException when the DSN is invalid
|
||||
*
|
||||
* @return \Redis|\RedisCluster|\Predis\Client According to the "class" option
|
||||
* @return \Redis|\RedisCluster|\Predis\ClientInterface According to the "class" option
|
||||
*/
|
||||
public static function createConnection($dsn, array $options = [])
|
||||
{
|
||||
@ -248,7 +248,7 @@ trait RedisTrait
|
||||
};
|
||||
|
||||
$redis = $params['lazy'] ? new RedisClusterProxy($initializer) : $initializer();
|
||||
} elseif (is_a($class, \Predis\Client::class, true)) {
|
||||
} elseif (is_a($class, \Predis\ClientInterface::class, true)) {
|
||||
if ($params['redis_cluster']) {
|
||||
$params['cluster'] = 'redis';
|
||||
if (isset($params['redis_sentinel'])) {
|
||||
@ -283,7 +283,7 @@ trait RedisTrait
|
||||
$redis->getConnection()->setSentinelTimeout($params['timeout']);
|
||||
}
|
||||
} elseif (class_exists($class, false)) {
|
||||
throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis", "RedisArray", "RedisCluster" nor "Predis\Client".', $class));
|
||||
throw new InvalidArgumentException(sprintf('"%s" is not a subclass of "Redis", "RedisArray", "RedisCluster" nor "Predis\ClientInterface".', $class));
|
||||
} else {
|
||||
throw new InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
|
||||
}
|
||||
@ -302,7 +302,7 @@ trait RedisTrait
|
||||
|
||||
$result = [];
|
||||
|
||||
if ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof ClusterInterface) {
|
||||
if ($this->redis instanceof \Predis\ClientInterface && $this->redis->getConnection() instanceof ClusterInterface) {
|
||||
$values = $this->pipeline(function () use ($ids) {
|
||||
foreach ($ids as $id) {
|
||||
yield 'get' => [$id];
|
||||
@ -335,7 +335,7 @@ trait RedisTrait
|
||||
protected function doClear($namespace)
|
||||
{
|
||||
$cleared = true;
|
||||
if ($this->redis instanceof \Predis\Client) {
|
||||
if ($this->redis instanceof \Predis\ClientInterface) {
|
||||
$evalArgs = [0, $namespace];
|
||||
} else {
|
||||
$evalArgs = [[$namespace], 0];
|
||||
@ -360,7 +360,7 @@ trait RedisTrait
|
||||
|
||||
$cursor = null;
|
||||
do {
|
||||
$keys = $host instanceof \Predis\Client ? $host->scan($cursor, 'MATCH', $namespace.'*', 'COUNT', 1000) : $host->scan($cursor, $namespace.'*', 1000);
|
||||
$keys = $host instanceof \Predis\ClientInterface ? $host->scan($cursor, 'MATCH', $namespace.'*', 'COUNT', 1000) : $host->scan($cursor, $namespace.'*', 1000);
|
||||
if (isset($keys[1]) && \is_array($keys[1])) {
|
||||
$cursor = $keys[0];
|
||||
$keys = $keys[1];
|
||||
@ -383,7 +383,7 @@ trait RedisTrait
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof ClusterInterface) {
|
||||
if ($this->redis instanceof \Predis\ClientInterface && $this->redis->getConnection() instanceof ClusterInterface) {
|
||||
$this->pipeline(function () use ($ids) {
|
||||
foreach ($ids as $id) {
|
||||
yield 'del' => [$id];
|
||||
@ -427,7 +427,7 @@ trait RedisTrait
|
||||
{
|
||||
$ids = [];
|
||||
|
||||
if ($this->redis instanceof RedisClusterProxy || $this->redis instanceof \RedisCluster || ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof RedisCluster)) {
|
||||
if ($this->redis instanceof RedisClusterProxy || $this->redis instanceof \RedisCluster || ($this->redis instanceof \Predis\ClientInterface && $this->redis->getConnection() instanceof RedisCluster)) {
|
||||
// phpredis & predis don't support pipelining with RedisCluster
|
||||
// see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining
|
||||
// see https://github.com/nrk/predis/issues/267#issuecomment-123781423
|
||||
@ -436,7 +436,7 @@ trait RedisTrait
|
||||
$results[] = $this->redis->{$command}(...$args);
|
||||
$ids[] = $args[0];
|
||||
}
|
||||
} elseif ($this->redis instanceof \Predis\Client) {
|
||||
} elseif ($this->redis instanceof \Predis\ClientInterface) {
|
||||
$results = $this->redis->pipeline(function ($redis) use ($generator, &$ids) {
|
||||
foreach ($generator() as $command => $args) {
|
||||
$redis->{$command}(...$args);
|
||||
@ -477,7 +477,7 @@ trait RedisTrait
|
||||
private function getHosts(): array
|
||||
{
|
||||
$hosts = [$this->redis];
|
||||
if ($this->redis instanceof \Predis\Client) {
|
||||
if ($this->redis instanceof \Predis\ClientInterface) {
|
||||
$connection = $this->redis->getConnection();
|
||||
if ($connection instanceof ClusterInterface && $connection instanceof \Traversable) {
|
||||
$hosts = [];
|
||||
|
@ -715,7 +715,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
||||
$dialog = new QuestionHelper();
|
||||
|
||||
$question = new Question('What\'s your name?');
|
||||
$question->setValidator(function () {
|
||||
$question->setValidator(function ($value) {
|
||||
if (!$value) {
|
||||
throw new \Exception('A value is required.');
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ class InputDefinitionTest extends TestCase
|
||||
{
|
||||
protected static $fixtures;
|
||||
|
||||
protected $multi;
|
||||
protected $foo;
|
||||
protected $bar;
|
||||
protected $foo1;
|
||||
|
@ -140,7 +140,7 @@ class QuestionTest extends TestCase
|
||||
{
|
||||
return [
|
||||
['Potato'],
|
||||
[new \stdclass()],
|
||||
[new \stdClass()],
|
||||
[false],
|
||||
];
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ class CommandTesterTest extends TestCase
|
||||
];
|
||||
|
||||
$command = new Command('foo');
|
||||
$command->setCode(function ($input, $output) use ($questions, $command) {
|
||||
$command->setCode(function ($input, $output) use ($questions) {
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$io->ask($questions[0]);
|
||||
$io->ask($questions[1]);
|
||||
|
@ -34,7 +34,7 @@ class RedisSessionHandler extends AbstractSessionHandler
|
||||
* List of available options:
|
||||
* * prefix: The prefix to use for the keys in order to avoid collision on the Redis server.
|
||||
*
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\Client|RedisProxy $redis
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|RedisProxy $redis
|
||||
*
|
||||
* @throws \InvalidArgumentException When unsupported client or options are passed
|
||||
*/
|
||||
@ -44,11 +44,11 @@ class RedisSessionHandler extends AbstractSessionHandler
|
||||
!$redis instanceof \Redis &&
|
||||
!$redis instanceof \RedisArray &&
|
||||
!$redis instanceof \RedisCluster &&
|
||||
!$redis instanceof \Predis\Client &&
|
||||
!$redis instanceof \Predis\ClientInterface &&
|
||||
!$redis instanceof RedisProxy &&
|
||||
!$redis instanceof RedisClusterProxy
|
||||
) {
|
||||
throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($redis) ? \get_class($redis) : \gettype($redis)));
|
||||
throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given', __METHOD__, \is_object($redis) ? \get_class($redis) : \gettype($redis)));
|
||||
}
|
||||
|
||||
if ($diff = array_diff(array_keys($options), ['prefix'])) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Ldap\Tests;
|
||||
namespace Symfony\Component\Ldap\Tests\Adapter\ExtLdap;
|
||||
|
||||
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
|
||||
use Symfony\Component\Ldap\Adapter\ExtLdap\Collection;
|
||||
@ -18,6 +18,7 @@ use Symfony\Component\Ldap\Entry;
|
||||
use Symfony\Component\Ldap\Exception\LdapException;
|
||||
use Symfony\Component\Ldap\Exception\NotBoundException;
|
||||
use Symfony\Component\Ldap\LdapInterface;
|
||||
use Symfony\Component\Ldap\Tests\LdapTestCase;
|
||||
|
||||
/**
|
||||
* @requires extension ldap
|
||||
|
@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Ldap\Tests;
|
||||
namespace Symfony\Component\Ldap\Tests\Adapter\ExtLdap;
|
||||
|
||||
use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
|
||||
use Symfony\Component\Ldap\Adapter\ExtLdap\Collection;
|
||||
@ -19,6 +19,7 @@ use Symfony\Component\Ldap\Exception\AlreadyExistsException;
|
||||
use Symfony\Component\Ldap\Exception\LdapException;
|
||||
use Symfony\Component\Ldap\Exception\NotBoundException;
|
||||
use Symfony\Component\Ldap\Exception\UpdateOperationException;
|
||||
use Symfony\Component\Ldap\Tests\LdapTestCase;
|
||||
|
||||
/**
|
||||
* @requires extension ldap
|
||||
|
@ -33,13 +33,13 @@ class RedisStore implements StoreInterface
|
||||
private $initialTtl;
|
||||
|
||||
/**
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\Client $redisClient
|
||||
* @param float $initialTtl the expiration delay of locks in seconds
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface $redisClient
|
||||
* @param float $initialTtl the expiration delay of locks in seconds
|
||||
*/
|
||||
public function __construct($redisClient, float $initialTtl = 300.0)
|
||||
{
|
||||
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\Client && !$redisClient instanceof RedisProxy) {
|
||||
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient)));
|
||||
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy) {
|
||||
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given', __METHOD__, \is_object($redisClient) ? \get_class($redisClient) : \gettype($redisClient)));
|
||||
}
|
||||
|
||||
if ($initialTtl <= 0) {
|
||||
@ -149,11 +149,11 @@ class RedisStore implements StoreInterface
|
||||
return $this->redis->_instance($this->redis->_target($resource))->eval($script, array_merge([$resource], $args), 1);
|
||||
}
|
||||
|
||||
if ($this->redis instanceof \Predis\Client) {
|
||||
if ($this->redis instanceof \Predis\ClientInterface) {
|
||||
return $this->redis->eval(...array_merge([$script, 1, $resource], $args));
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException(sprintf('%s() expects being initialized with a Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($this->redis) ? \get_class($this->redis) : \gettype($this->redis)));
|
||||
throw new InvalidArgumentException(sprintf('%s() expects being initialized with a Redis, RedisArray, RedisCluster or Predis\ClientInterface, %s given', __METHOD__, \is_object($this->redis) ? \get_class($this->redis) : \gettype($this->redis)));
|
||||
}
|
||||
|
||||
private function getUniqueToken(Key $key): string
|
||||
|
@ -25,7 +25,7 @@ use Symfony\Component\Lock\PersistingStoreInterface;
|
||||
class StoreFactory
|
||||
{
|
||||
/**
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\Client|\Memcached|\Zookeeper|string $connection Connection or DSN or Store short name
|
||||
* @param \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface|\Memcached|\Zookeeper|string $connection Connection or DSN or Store short name
|
||||
*
|
||||
* @return PersistingStoreInterface
|
||||
*/
|
||||
@ -35,7 +35,7 @@ class StoreFactory
|
||||
$connection instanceof \Redis ||
|
||||
$connection instanceof \RedisArray ||
|
||||
$connection instanceof \RedisCluster ||
|
||||
$connection instanceof \Predis\Client ||
|
||||
$connection instanceof \Predis\ClientInterface ||
|
||||
$connection instanceof RedisProxy ||
|
||||
$connection instanceof RedisClusterProxy
|
||||
) {
|
||||
|
@ -32,7 +32,7 @@ abstract class AbstractRedisStoreTest extends AbstractStoreTest
|
||||
/**
|
||||
* Return a RedisConnection.
|
||||
*
|
||||
* @return \Redis|\RedisArray|\RedisCluster|\Predis\Client
|
||||
* @return \Redis|\RedisArray|\RedisCluster|\Predis\ClientInterface
|
||||
*/
|
||||
abstract protected function getRedisConnection();
|
||||
|
||||
|
@ -185,7 +185,7 @@ EOF
|
||||
|
||||
$count = 0;
|
||||
try {
|
||||
$worker->run([], function (?Envelope $envelope) use ($worker, $io, &$count) {
|
||||
$worker->run([], function (?Envelope $envelope) use ($worker, &$count) {
|
||||
++$count;
|
||||
if (null === $envelope) {
|
||||
$worker->stop();
|
||||
|
@ -378,7 +378,7 @@ class WorkerTest extends TestCase
|
||||
$worker = new Worker([$receiver], $bus);
|
||||
$workerWithDecorator = new StopWhenMessageCountIsExceededWorker($worker, 2);
|
||||
$processedEnvelopes = [];
|
||||
$workerWithDecorator->run([], function (?Envelope $envelope) use ($worker, &$processedEnvelopes) {
|
||||
$workerWithDecorator->run([], function (?Envelope $envelope) use (&$processedEnvelopes) {
|
||||
if (null !== $envelope) {
|
||||
$processedEnvelopes[] = $envelope;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ final class ParameterizedHeader extends UnstructuredHeader
|
||||
$this->setParameter($k, $v);
|
||||
}
|
||||
|
||||
if ('content-disposition' === strtolower($name)) {
|
||||
if ('content-type' !== strtolower($name)) {
|
||||
$this->encoder = new Rfc2231Encoder();
|
||||
}
|
||||
}
|
||||
|
@ -205,16 +205,25 @@ class ParameterizedHeaderTest extends TestCase
|
||||
$header = new ParameterizedHeader('X-Foo', $value);
|
||||
$header->setCharset('iso-8859-1');
|
||||
$header->setParameters(['says' => $value]);
|
||||
$this->assertEquals('X-Foo: =?'.$header->getCharset().'?Q?fo=8Fbar?=; says="=?'.$header->getCharset().'?Q?fo=8Fbar?="', $header->toString());
|
||||
$this->assertEquals('X-Foo: =?'.$header->getCharset().'?Q?fo=8Fbar?=; says*='.$header->getCharset()."''fo%8Fbar", $header->toString());
|
||||
}
|
||||
|
||||
public function testParamsAreEncodedWithEncodedWordsIfNoParamEncoderSet()
|
||||
public function testParamsAreEncodedIfNonAscii()
|
||||
{
|
||||
$value = 'fo'.pack('C', 0x8F).'bar';
|
||||
$header = new ParameterizedHeader('X-Foo', 'bar');
|
||||
$header->setCharset('iso-8859-1');
|
||||
$header->setParameters(['says' => $value]);
|
||||
$this->assertEquals('X-Foo: bar; says="=?'.$header->getCharset().'?Q?fo=8Fbar?="', $header->toString());
|
||||
$this->assertEquals('X-Foo: bar; says*='.$header->getCharset()."''fo%8Fbar", $header->toString());
|
||||
}
|
||||
|
||||
public function testParamsAreEncodedWithLegacyEncodingEnabled()
|
||||
{
|
||||
$value = 'fo'.pack('C', 0x8F).'bar';
|
||||
$header = new ParameterizedHeader('Content-Type', 'bar');
|
||||
$header->setCharset('iso-8859-1');
|
||||
$header->setParameters(['says' => $value]);
|
||||
$this->assertEquals('Content-Type: bar; says="=?'.$header->getCharset().'?Q?fo=8Fbar?="', $header->toString());
|
||||
}
|
||||
|
||||
public function testLanguageInformationAppearsInEncodedWords()
|
||||
@ -234,6 +243,18 @@ class ParameterizedHeaderTest extends TestCase
|
||||
tag. For example:
|
||||
|
||||
From: =?US-ASCII*EN?Q?Keith_Moore?= <moore@cs.utk.edu>
|
||||
|
||||
-- RFC 2047, 5. Use of encoded-words in message headers
|
||||
...
|
||||
+ An 'encoded-word' MUST NOT be used in parameter of a MIME
|
||||
Content-Type or Content-Disposition field, or in any structured
|
||||
field body except within a 'comment' or 'phrase'.
|
||||
|
||||
-- RFC 2047, Appendix - changes since RFC 1522
|
||||
...
|
||||
+ clarify that encoded-words are allowed in '*text' fields in both
|
||||
RFC822 headers and MIME body part headers, but NOT as parameter
|
||||
values.
|
||||
*/
|
||||
|
||||
$value = 'fo'.pack('C', 0x8F).'bar';
|
||||
@ -241,7 +262,7 @@ class ParameterizedHeaderTest extends TestCase
|
||||
$header->setCharset('iso-8859-1');
|
||||
$header->setLanguage('en');
|
||||
$header->setParameters(['says' => $value]);
|
||||
$this->assertEquals('X-Foo: =?'.$header->getCharset().'*en?Q?fo=8Fbar?=; says="=?'.$header->getCharset().'*en?Q?fo=8Fbar?="', $header->toString());
|
||||
$this->assertEquals('X-Foo: =?'.$header->getCharset().'*en?Q?fo=8Fbar?=; says*='.$header->getCharset()."'en'fo%8Fbar", $header->toString());
|
||||
}
|
||||
|
||||
public function testSetBody()
|
||||
|
@ -40,7 +40,7 @@ class PhpFileLoader extends FileLoader
|
||||
|
||||
// the closure forbids access to the private scope in the included file
|
||||
$loader = $this;
|
||||
$load = \Closure::bind(static function ($file) use ($loader) {
|
||||
$load = \Closure::bind(static function ($file) {
|
||||
return include $file;
|
||||
}, null, ProtectedPhpFileLoader::class);
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\Routing\Matcher\Dumper;
|
||||
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use "CompiledUrlMatcherDumper" instead.', PhpMatcherDumper::class), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "CompiledUrlMatcherDumper" instead.', PhpMatcherDumper::class), E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes.
|
||||
|
@ -165,7 +165,7 @@ class CsrfTokenManagerTest extends TestCase
|
||||
$requestStack = new RequestStack();
|
||||
$requestStack->push(new Request([], [], [], [], [], ['HTTPS' => 'on']));
|
||||
|
||||
$manager = new CsrfTokenManager($generator, $storage, null, $requestStack);
|
||||
$manager = new CsrfTokenManager($generator, $storage);
|
||||
|
||||
$token = $manager->getToken('foo');
|
||||
$this->assertSame('foo', $token->getId());
|
||||
|
@ -138,7 +138,7 @@ class Firewall implements EventSubscriberInterface
|
||||
if (\is_callable($listener)) {
|
||||
$listener($event);
|
||||
} else {
|
||||
@trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, implement "__invoke()" instead.', \get_class($this)), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, implement "__invoke()" instead.', \get_class($listener)), E_USER_DEPRECATED);
|
||||
$listener->handle($event);
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\Security\Http\Firewall;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||
|
||||
|
@ -109,7 +109,7 @@ class SwitchUserListenerTest extends TestCase
|
||||
public function testExitUserBasedOnSwitchUserRoleUpdatesToken()
|
||||
{
|
||||
$originalToken = new UsernamePasswordToken('username', '', 'key', []);
|
||||
$this->tokenStorage->setToken(new UsernamePasswordToken('username', '', 'key', [new SwitchUserRole('ROLE_PREVIOUS', $originalToken, false)], $originalToken));
|
||||
$this->tokenStorage->setToken(new UsernamePasswordToken('username', '', 'key', [new SwitchUserRole('ROLE_PREVIOUS', $originalToken, false)]));
|
||||
|
||||
$this->request->query->set('_switch_user', SwitchUserListener::EXIT_VALUE);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Tests\Http\Firewall;
|
||||
namespace Symfony\Component\Security\Http\Tests\Firewall;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Tests\Http\Firewall;
|
||||
namespace Symfony\Component\Security\Http\Tests\Firewall;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -37,11 +37,6 @@ class ProjectTemplateLoader4 extends Loader
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
public function getDebugger()
|
||||
{
|
||||
return $this->debugger;
|
||||
}
|
||||
|
||||
public function isFresh(TemplateReferenceInterface $template, $time): bool
|
||||
{
|
||||
return false;
|
||||
|
@ -94,7 +94,7 @@ class PhpEngineTest extends TestCase
|
||||
|
||||
public function testExtendRender()
|
||||
{
|
||||
$engine = new ProjectTemplateEngine(new TemplateNameParser(), $this->loader, [], [new SlotsHelper()]);
|
||||
$engine = new ProjectTemplateEngine(new TemplateNameParser(), $this->loader, []);
|
||||
try {
|
||||
$engine->render('name');
|
||||
$this->fail('->render() throws an InvalidArgumentException if the template does not exist');
|
||||
|
Reference in New Issue
Block a user