Merge branch '3.4' into 4.0
* 3.4: fix merge fixed wrong description in a phpdoc 19 digits VISA card numbers are valid Add missing @ in phpdoc return statement Don't right trim the deprecation message [HttpKernel] Fixed test name [Debug] prevent infinite loop with faulty exception handlers [FrameworkBundle] fix tests Prefer composer install instead for using Symfony Installer Add the missing `enabled` session attribute [HttpKernel] Turn bad hosts into 400 instead of 500
This commit is contained in:
commit
c8d5deed8d
@ -10,8 +10,7 @@ Drupal and Magento).
|
||||
Installation
|
||||
------------
|
||||
|
||||
* [Install Symfony][4] with Composer or with our own installer (see
|
||||
[requirements details][3]).
|
||||
* [Install Symfony][4] with Composer (see [requirements details][3]).
|
||||
* Symfony follows the [semantic versioning][5] strictly, publishes "Long Term
|
||||
Support" (LTS) versions and has a [release process][6] that is predictable and
|
||||
business-friendly.
|
||||
|
@ -228,7 +228,7 @@ class DeprecationErrorHandler
|
||||
uasort($deprecations[$group], $cmp);
|
||||
|
||||
foreach ($deprecations[$group] as $msg => $notices) {
|
||||
echo "\n", rtrim($msg, '.'), ': ', $notices['count'], "x\n";
|
||||
echo "\n ", $notices['count'], 'x: ', $msg, "\n";
|
||||
|
||||
arsort($notices);
|
||||
|
||||
|
@ -63,20 +63,20 @@ $foo->testNonLegacyBar();
|
||||
--EXPECTF--
|
||||
Unsilenced deprecation notices (3)
|
||||
|
||||
unsilenced foo deprecation: 2x
|
||||
2x: unsilenced foo deprecation
|
||||
2x in FooTestCase::testLegacyFoo
|
||||
|
||||
unsilenced bar deprecation: 1x
|
||||
1x: unsilenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Remaining deprecation notices (1)
|
||||
|
||||
silenced bar deprecation: 1x
|
||||
1x: silenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Legacy deprecation notices (1)
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
root deprecation: 1x
|
||||
1x: root deprecation
|
||||
|
||||
|
@ -55,20 +55,20 @@ $foo->testNonLegacyBar();
|
||||
--EXPECTF--
|
||||
Unsilenced deprecation notices (3)
|
||||
|
||||
unsilenced foo deprecation: 2x
|
||||
2x: unsilenced foo deprecation
|
||||
2x in FooTestCase::testLegacyFoo
|
||||
|
||||
unsilenced bar deprecation: 1x
|
||||
1x: unsilenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Remaining deprecation notices (1)
|
||||
|
||||
silenced bar deprecation: 1x
|
||||
1x: silenced bar deprecation
|
||||
1x in FooTestCase::testNonLegacyBar
|
||||
|
||||
Legacy deprecation notices (1)
|
||||
|
||||
Other deprecation notices (1)
|
||||
|
||||
root deprecation: 1x
|
||||
1x: root deprecation
|
||||
|
||||
|
@ -103,6 +103,7 @@
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="session">
|
||||
<xsd:attribute name="enabled" type="xsd:boolean" />
|
||||
<xsd:attribute name="storage-id" type="xsd:string" />
|
||||
<xsd:attribute name="handler-id" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
|
@ -31,7 +31,7 @@ interface AdapterInterface extends CacheItemPoolInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* return \Traversable|CacheItem[]
|
||||
* @return \Traversable|CacheItem[]
|
||||
*/
|
||||
public function getItems(array $keys = array());
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class StringInput extends ArgvInput
|
||||
const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
|
||||
|
||||
/**
|
||||
* @param string $input An array of parameters from the CLI (in the argv format)
|
||||
* @param string $input A string representing the parameters from the CLI
|
||||
*/
|
||||
public function __construct(string $input)
|
||||
{
|
||||
|
@ -563,6 +563,8 @@ class ErrorHandler
|
||||
|
||||
$handler = self::$reservedMemory = null;
|
||||
$handlers = array();
|
||||
$previousHandler = null;
|
||||
$sameHandlerLimit = 10;
|
||||
|
||||
while (!is_array($handler) || !$handler[0] instanceof self) {
|
||||
$handler = set_exception_handler('var_dump');
|
||||
@ -572,7 +574,14 @@ class ErrorHandler
|
||||
break;
|
||||
}
|
||||
restore_exception_handler();
|
||||
array_unshift($handlers, $handler);
|
||||
|
||||
if ($handler !== $previousHandler) {
|
||||
array_unshift($handlers, $handler);
|
||||
$previousHandler = $handler;
|
||||
} elseif (0 === --$sameHandlerLimit) {
|
||||
$handler = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach ($handlers as $h) {
|
||||
set_exception_handler($h);
|
||||
|
@ -17,6 +17,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
@ -76,7 +77,11 @@ class RouterListener implements EventSubscriberInterface
|
||||
private function setCurrentRequest(Request $request = null)
|
||||
{
|
||||
if (null !== $request) {
|
||||
$this->context->fromRequest($request);
|
||||
try {
|
||||
$this->context->fromRequest($request);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
throw new BadRequestHttpException($e->getMessage(), $e, $e->getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,4 +203,19 @@ class RouterListenerTest extends TestCase
|
||||
$this->assertSame(404, $response->getStatusCode());
|
||||
$this->assertContains('Welcome', $response->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
*/
|
||||
public function testRequestWithBadHost()
|
||||
{
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
|
||||
$request = Request::create('http://bad host %22/');
|
||||
$event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
|
||||
|
||||
$requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
|
||||
|
||||
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
|
||||
$listener->onKernelRequest($event);
|
||||
}
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ class CardSchemeValidator extends ConstraintValidator
|
||||
'/^5[1-5][0-9]{14}$/',
|
||||
'/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/',
|
||||
),
|
||||
// All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
|
||||
// All Visa card numbers start with a 4 and have a length of 13, 16, or 19 digits.
|
||||
'VISA' => array(
|
||||
'/^4([0-9]{12}|[0-9]{15})$/',
|
||||
'/^4([0-9]{12}|[0-9]{15}|[0-9]{18})$/',
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -106,6 +106,7 @@ class CardSchemeValidatorTest extends ConstraintValidatorTestCase
|
||||
array('VISA', '4111111111111111'),
|
||||
array('VISA', '4012888888881881'),
|
||||
array('VISA', '4222222222222'),
|
||||
array('VISA', '4917610000000000003'),
|
||||
array(array('AMEX', 'VISA'), '4111111111111111'),
|
||||
array(array('AMEX', 'VISA'), '378282246310005'),
|
||||
array(array('JCB', 'MASTERCARD'), '5105105105105100'),
|
||||
|
Reference in New Issue
Block a user