Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0de958

Browse files
committed
Merge branch '2.4'
* 2.4: Check headers sent before sending PHP response Fix issue#10345 '[FrameworkBundle][Console] container:debug --parameter="" not working anymore' Fixed ACE domain checks on UrlValidator (#10031) handle array root element
2 parents830ab24 +af6d11c commite0de958

File tree

6 files changed

+58
-6
lines changed

6 files changed

+58
-6
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function describe(OutputInterface $output, $object, array $options = arra
5555
$this->describeContainerService($this->resolveServiceDefinition($object,$options['id']),$options);
5656
break;
5757
case$objectinstanceof ContainerBuilder &&isset($options['parameter']):
58-
$this->formatParameter($object->getParameter($options['parameter']));
58+
$this->describeContainerParameter($object->getParameter($options['parameter']),$options);
5959
break;
6060
case$objectinstanceof ContainerBuilder:
6161
$this->describeContainerServices($object,$options);
@@ -114,6 +114,17 @@ abstract protected function describeRouteCollection(RouteCollection $routes, arr
114114
*/
115115
abstractprotectedfunctiondescribeRoute(Route$route,array$options =array());
116116

117+
/**
118+
* Describes a specific container parameter.
119+
*
120+
* @param mixed $parameterValue
121+
* @param array $options
122+
*/
123+
protectedfunctiondescribeContainerParameter($parameterValue,array$options =array())
124+
{
125+
$this->write($this->formatParameter($parameterValue));
126+
}
127+
117128
/**
118129
* Describes container parameters.
119130
*

‎src/Symfony/Component/Debug/ExceptionHandler.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ public function sendPhpResponse($exception)
9191
$exception = FlattenException::create($exception);
9292
}
9393

94-
header(sprintf('HTTP/1.0 %s',$exception->getStatusCode()));
95-
foreach ($exception->getHeaders()as$name =>$value) {
96-
header($name.':'.$value,false);
94+
if (!headers_sent()) {
95+
header(sprintf('HTTP/1.0 %s',$exception->getStatusCode()));
96+
foreach ($exception->getHeaders()as$name =>$value) {
97+
header($name.':'.$value,false);
98+
}
9799
}
98100

99101
echo$this->decorate($this->getContent($exception),$this->getStylesheet($exception));

‎src/Symfony/Component/Validator/ConstraintViolation.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,14 @@ public function __construct($message, $messageTemplate, array $messageParameters
9595
*/
9696
publicfunction__toString()
9797
{
98-
$class = (string) (is_object($this->root) ?get_class($this->root) :$this->root);
98+
if (is_object($this->root)) {
99+
$class =get_class($this->root);
100+
}elseif (is_array($this->root)) {
101+
$class ="Array";
102+
}else {
103+
$class = (string)$this->root;
104+
}
105+
99106
$propertyPath = (string)$this->propertyPath;
100107
$code =$this->code;
101108

‎src/Symfony/Component/Validator/Constraints/UrlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class UrlValidator extends ConstraintValidator
2525
constPATTERN ='~^
2626
(%s):// # protocol
2727
(
28-
([\pL\pN\pS-]+\.)+[\pL]+ # a domain name
28+
([\pL\pN\pS-]+\.)+([\pL]|xn\-\-[\pL\pN-]+)+ # a domain name
2929
| # or
3030
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # a IP address
3131
| # or

‎src/Symfony/Component/Validator/Tests/ConstraintViolationTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,23 @@ public function testToStringHandlesArrays()
3333

3434
$this->assertSame($expected, (string)$violation);
3535
}
36+
37+
publicfunctiontestToStringHandlesArrayRoots()
38+
{
39+
$violation =newConstraintViolation(
40+
'42 cannot be used here',
41+
'this is the message template',
42+
array(),
43+
array('some_value' =>42),
44+
'some_value',
45+
null
46+
);
47+
48+
$expected =<<<EOF
49+
Array.some_value:
50+
42 cannot be used here
51+
EOF;
52+
53+
$this->assertSame($expected, (string)$violation);
54+
}
3655
}

‎src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,28 @@ public function getValidUrls()
9191
array('http://[::1]:80/'),
9292
array('http://[1:2:3::4:5:6:7]/'),
9393
array('http://sãopaulo.com/'),
94+
array('http://xn--sopaulo-xwa.com/'),
9495
array('http://sãopaulo.com.br/'),
96+
array('http://xn--sopaulo-xwa.com.br/'),
9597
array('http://пример.испытание/'),
98+
array('http://xn--e1afmkfd.xn--80akhbyknj4f/'),
9699
array('http://مثال.إختبار/'),
100+
array('http://xn--mgbh0fb.xn--kgbechtv/'),
97101
array('http://例子.测试/'),
102+
array('http://xn--fsqu00a.xn--0zwm56d/'),
98103
array('http://例子.測試/'),
104+
array('http://xn--fsqu00a.xn--g6w251d/'),
99105
array('http://例え.テスト/'),
106+
array('http://xn--r8jz45g.xn--zckzah/'),
100107
array('http://مثال.آزمایشی/'),
108+
array('http://xn--mgbh0fb.xn--hgbk6aj7f53bba/'),
101109
array('http://실례.테스트/'),
110+
array('http://xn--9n2bp8q.xn--9t4b11yi5a/'),
102111
array('http://العربية.idn.icann.org/'),
112+
array('http://xn--ogb.idn.icann.org/'),
113+
array('http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'),
114+
array('http://xn--espaa-rta.xn--ca-ol-fsay5a/'),
115+
array('http://xn--d1abbgf6aiiy.xn--p1ai/'),
103116
array('http://☎.com/'),
104117
);
105118
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp