Merge branch '5.2' into 5.x

* 5.2:
  remove unreachable code
  [Browserkit] Add changelog entry for request parameters string cast
  Update ExceptionEvent.php
  fix firebase transport factory DI tag type
  [Validator] Resolve IsinValidator's dependency on the validator.
  [HttpFoundation] Fix for virtualhosts based on URL path
This commit is contained in:
Alexander M. Turek 2020-11-16 00:08:54 +01:00
commit 2a453c2c89
7 changed files with 51 additions and 42 deletions

View File

@ -73,7 +73,7 @@ return static function (ContainerConfigurator $container) {
->set('notifier.transport_factory.firebase', FirebaseTransportFactory::class)
->parent('notifier.transport_factory.abstract')
->tag('texter.transport_factory')
->tag('chatter.transport_factory')
->set('notifier.transport_factory.freemobile', FreeMobileTransportFactory::class)
->parent('notifier.transport_factory.abstract')

View File

@ -6,6 +6,11 @@ CHANGELOG
* Added `jsonRequest` method to `AbstractBrowser`
5.2.0
-----
* [BC BREAK] Request parameters are now casted to string in `Request::__construct()`.
4.3.0
-----
@ -19,7 +24,7 @@ CHANGELOG
4.2.0
-----
* The method `Client::submit()` will have a new `$serverParameters` argument
* The method `Client::submit()` will have a new `$serverParameters` argument
in version 5.0, not defining it is deprecated
* Added ability to read the "samesite" attribute of cookies using `Cookie::getSameSite()`

View File

@ -1907,9 +1907,15 @@ class Request
}
$basename = basename($baseUrl);
if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) {
// no match whatsoever; set it blank
return '';
if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri).'/', '/'.$basename.'/')) {
// strip autoindex filename, for virtualhost based on URL path
$baseUrl = \dirname($baseUrl).'/';
$basename = basename($baseUrl);
if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri).'/', '/'.$basename.'/')) {
// no match whatsoever; set it blank
return '';
}
}
// If using mod_rewrite or ISAPI_Rewrite strip the script filename

View File

@ -1785,6 +1785,36 @@ class RequestTest extends TestCase
'/foo',
'/bar+baz',
],
[
'/sub/foo/bar',
[
'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php',
'SCRIPT_NAME' => '/foo/app.php',
'PHP_SELF' => '/foo/app.php',
],
'/sub/foo',
'/bar',
],
[
'/sub/foo/app.php/bar',
[
'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php',
'SCRIPT_NAME' => '/foo/app.php',
'PHP_SELF' => '/foo/app.php',
],
'/sub/foo/app.php',
'/bar',
],
[
'/sub/foo/bar/baz',
[
'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app2.phpx',
'SCRIPT_NAME' => '/foo/app2.phpx',
'PHP_SELF' => '/foo/app2.phpx',
],
'/sub/foo',
'/bar/baz',
],
];
}

View File

@ -15,7 +15,6 @@ use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException;
use Symfony\Component\Validator\Validator\ValidatorInterface;
/**
* @author Laurent Masforné <l.masforne@gmail.com>
@ -24,16 +23,6 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
*/
class IsinValidator extends ConstraintValidator
{
/**
* @var ValidatorInterface
*/
private $validator;
public function __construct(ValidatorInterface $validator)
{
$this->validator = $validator;
}
/**
* {@inheritdoc}
*/
@ -87,6 +76,6 @@ class IsinValidator extends ConstraintValidator
}
$number = implode('', $characters);
return 0 === $this->validator->validate($number, new Luhn())->count();
return 0 === $this->context->getValidator()->validate($number, new Luhn())->count();
}
}

View File

@ -4,16 +4,14 @@ namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Constraints\Isin;
use Symfony\Component\Validator\Constraints\IsinValidator;
use Symfony\Component\Validator\Constraints\Luhn;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
use Symfony\Component\Validator\ValidatorBuilder;
class IsinValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator()
{
$validatorBuilder = new ValidatorBuilder();
return new IsinValidator($validatorBuilder->getValidator());
return new IsinValidator();
}
public function testNullIsValid()
@ -36,6 +34,7 @@ class IsinValidatorTest extends ConstraintValidatorTestCase
public function testValidIsin($isin)
{
$this->validator->validate($isin, new Isin());
$this->expectViolationsAt(0, $isin, new Luhn());
$this->assertNoViolation();
}
@ -103,6 +102,7 @@ class IsinValidatorTest extends ConstraintValidatorTestCase
*/
public function testIsinWithValidFormatButIncorrectChecksum($isin)
{
$this->expectViolationsAt(0, $isin, new Luhn());
$this->assertViolationRaised($isin, Isin::INVALID_CHECKSUM_ERROR);
}

View File

@ -1190,27 +1190,6 @@ class Parser
}
return $value;
for ($i = 1; isset($yaml[$i]) && $quotation !== $yaml[$i]; ++$i) {
}
// quoted single line string
if (isset($yaml[$i]) && $quotation === $yaml[$i]) {
return $yaml;
}
$lines = [$yaml];
while ($this->moveToNextLine()) {
for ($i = 1; isset($this->currentLine[$i]) && $quotation !== $this->currentLine[$i]; ++$i) {
}
$lines[] = trim($this->currentLine);
if (isset($this->currentLine[$i]) && $quotation === $this->currentLine[$i]) {
break;
}
}
}
private function lexInlineMapping(string $yaml): string