Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 07b5304

Browse files
Merge branch '2.8' into 3.3
* 2.8: fixed wrong description in a phpdoc 19 digits VISA card numbers are valid [HttpKernel] Fixed test name [Debug] prevent infinite loop with faulty exception handlers Add the missing `enabled` session attribute [HttpKernel] Turn bad hosts into 400 instead of 500
2 parents c2681e7 + 4a211d8 commit 07b5304

File tree

7 files changed

+36
-5
lines changed

7 files changed

+36
-5
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
</xsd:complexType>
103103

104104
<xsd:complexType name="session">
105+
<xsd:attribute name="enabled" type="xsd:boolean" />
105106
<xsd:attribute name="storage-id" type="xsd:string" />
106107
<xsd:attribute name="handler-id" type="xsd:string" />
107108
<xsd:attribute name="name" type="xsd:string" />

src/Symfony/Component/Console/Input/StringInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class StringInput extends ArgvInput
2828
const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
2929

3030
/**
31-
* @param string $input An array of parameters from the CLI (in the argv format)
31+
* @param string $input A string representing the parameters from the CLI
3232
*/
3333
public function __construct($input)
3434
{

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ public static function handleFatalError(array $error = null)
592592

593593
$handler = self::$reservedMemory = null;
594594
$handlers = array();
595+
$previousHandler = null;
596+
$sameHandlerLimit = 10;
595597

596598
while (!is_array($handler) || !$handler[0] instanceof self) {
597599
$handler = set_exception_handler('var_dump');
@@ -601,7 +603,14 @@ public static function handleFatalError(array $error = null)
601603
break;
602604
}
603605
restore_exception_handler();
604-
array_unshift($handlers, $handler);
606+
607+
if ($handler !== $previousHandler) {
608+
array_unshift($handlers, $handler);
609+
$previousHandler = $handler;
610+
} elseif (0 === --$sameHandlerLimit) {
611+
$handler = null;
612+
break;
613+
}
605614
}
606615
foreach ($handlers as $h) {
607616
set_exception_handler($h);

src/Symfony/Component/HttpKernel/EventListener/RouterListener.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1616
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
1717
use Symfony\Component\HttpKernel\KernelEvents;
18+
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1819
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
1920
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2021
use Symfony\Component\HttpFoundation\RequestStack;
@@ -66,7 +67,11 @@ public function __construct($matcher, RequestStack $requestStack, RequestContext
6667
private function setCurrentRequest(Request $request = null)
6768
{
6869
if (null !== $request) {
69-
$this->context->fromRequest($request);
70+
try {
71+
$this->context->fromRequest($request);
72+
} catch (\UnexpectedValueException $e) {
73+
throw new BadRequestHttpException($e->getMessage(), $e, $e->getCode());
74+
}
7075
}
7176
}
7277

src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,19 @@ public function testWithBadRequest()
185185
$response = $kernel->handle($request);
186186
$this->assertSame(400, $response->getStatusCode());
187187
}
188+
189+
/**
190+
* @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
191+
*/
192+
public function testRequestWithBadHost()
193+
{
194+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
195+
$request = Request::create('http://bad host %22/');
196+
$event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
197+
198+
$requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
199+
200+
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
201+
$listener->onKernelRequest($event);
202+
}
188203
}

src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ class CardSchemeValidator extends ConstraintValidator
7878
'/^5[1-5][0-9]{14}$/',
7979
'/^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})$/',
8080
),
81-
// All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
81+
// All Visa card numbers start with a 4 and have a length of 13, 16, or 19 digits.
8282
'VISA' => array(
83-
'/^4([0-9]{12}|[0-9]{15})$/',
83+
'/^4([0-9]{12}|[0-9]{15}|[0-9]{18})$/',
8484
),
8585
);
8686

src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public function getValidNumbers()
106106
array('VISA', '4111111111111111'),
107107
array('VISA', '4012888888881881'),
108108
array('VISA', '4222222222222'),
109+
array('VISA', '4917610000000000003'),
109110
array(array('AMEX', 'VISA'), '4111111111111111'),
110111
array(array('AMEX', 'VISA'), '378282246310005'),
111112
array(array('JCB', 'MASTERCARD'), '5105105105105100'),

0 commit comments

Comments
 (0)