Skip to content

Commit 3316e42

Browse files
Merge branch '3.3' into 3.4
* 3.3: 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 Add the missing `enabled` session attribute [HttpKernel] Turn bad hosts into 400 instead of 500
2 parents aa5f7ea + f657057 commit 3316e42

File tree

11 files changed

+46
-15
lines changed

11 files changed

+46
-15
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public static function register($mode = 0)
228228
uasort($deprecations[$group], $cmp);
229229

230230
foreach ($deprecations[$group] as $msg => $notices) {
231-
echo "\n", rtrim($msg, '.'), ': ', $notices['count'], "x\n";
231+
echo "\n ", $notices['count'], 'x: ', $msg, "\n";
232232

233233
arsort($notices);
234234

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ $foo->testNonLegacyBar();
6363
--EXPECTF--
6464
Unsilenced deprecation notices (3)
6565

66-
unsilenced foo deprecation: 2x
66+
2x: unsilenced foo deprecation
6767
2x in FooTestCase::testLegacyFoo
6868

69-
unsilenced bar deprecation: 1x
69+
1x: unsilenced bar deprecation
7070
1x in FooTestCase::testNonLegacyBar
7171

7272
Remaining deprecation notices (1)
7373

74-
silenced bar deprecation: 1x
74+
1x: silenced bar deprecation
7575
1x in FooTestCase::testNonLegacyBar
7676

7777
Legacy deprecation notices (1)
7878

7979
Other deprecation notices (1)
8080

81-
root deprecation: 1x
81+
1x: root deprecation
8282

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,20 @@ $foo->testNonLegacyBar();
5555
--EXPECTF--
5656
Unsilenced deprecation notices (3)
5757

58-
unsilenced foo deprecation: 2x
58+
2x: unsilenced foo deprecation
5959
2x in FooTestCase::testLegacyFoo
6060

61-
unsilenced bar deprecation: 1x
61+
1x: unsilenced bar deprecation
6262
1x in FooTestCase::testNonLegacyBar
6363

6464
Remaining deprecation notices (1)
6565

66-
silenced bar deprecation: 1x
66+
1x: silenced bar deprecation
6767
1x in FooTestCase::testNonLegacyBar
6868

6969
Legacy deprecation notices (1)
7070

7171
Other deprecation notices (1)
7272

73-
root deprecation: 1x
73+
1x: root deprecation
7474

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
@@ -103,6 +103,7 @@
103103
</xsd:complexType>
104104

105105
<xsd:complexType name="session">
106+
<xsd:attribute name="enabled" type="xsd:boolean" />
106107
<xsd:attribute name="storage-id" type="xsd:string" />
107108
<xsd:attribute name="handler-id" type="xsd:string" />
108109
<xsd:attribute name="name" type="xsd:string" />

src/Symfony/Component/Cache/Adapter/AdapterInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function getItem($key);
3131
/**
3232
* {@inheritdoc}
3333
*
34-
* return \Traversable|CacheItem[]
34+
* @return \Traversable|CacheItem[]
3535
*/
3636
public function getItems(array $keys = array());
3737
}

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
@@ -596,6 +596,8 @@ public static function handleFatalError(array $error = null)
596596

597597
$handler = self::$reservedMemory = null;
598598
$handlers = array();
599+
$previousHandler = null;
600+
$sameHandlerLimit = 10;
599601

600602
while (!is_array($handler) || !$handler[0] instanceof self) {
601603
$handler = set_exception_handler('var_dump');
@@ -605,7 +607,14 @@ public static function handleFatalError(array $error = null)
605607
break;
606608
}
607609
restore_exception_handler();
608-
array_unshift($handlers, $handler);
610+
611+
if ($handler !== $previousHandler) {
612+
array_unshift($handlers, $handler);
613+
$previousHandler = $handler;
614+
} elseif (0 === --$sameHandlerLimit) {
615+
$handler = null;
616+
break;
617+
}
609618
}
610619
foreach ($handlers as $h) {
611620
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
@@ -17,6 +17,7 @@
1717
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
1818
use Symfony\Component\HttpKernel\Kernel;
1919
use Symfony\Component\HttpKernel\KernelEvents;
20+
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
2021
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
2122
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2223
use Symfony\Component\HttpFoundation\RequestStack;
@@ -76,7 +77,11 @@ public function __construct($matcher, RequestStack $requestStack, RequestContext
7677
private function setCurrentRequest(Request $request = null)
7778
{
7879
if (null !== $request) {
79-
$this->context->fromRequest($request);
80+
try {
81+
$this->context->fromRequest($request);
82+
} catch (\UnexpectedValueException $e) {
83+
throw new BadRequestHttpException($e->getMessage(), $e, $e->getCode());
84+
}
8085
}
8186
}
8287

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,19 @@ public function testNoRoutingConfigurationResponse()
208208
$this->assertSame(404, $response->getStatusCode());
209209
$this->assertContains('Welcome', $response->getContent());
210210
}
211+
212+
/**
213+
* @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
214+
*/
215+
public function testRequestWithBadHost()
216+
{
217+
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
218+
$request = Request::create('http://bad host %22/');
219+
$event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
220+
221+
$requestMatcher = $this->getMockBuilder('Symfony\Component\Routing\Matcher\RequestMatcherInterface')->getMock();
222+
223+
$listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext());
224+
$listener->onKernelRequest($event);
225+
}
211226
}

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

0 commit comments

Comments
 (0)