Skip to content

Commit 6dc5f59

Browse files
Merge branch '3.3' into 3.4
* 3.3: use Precise on Travis to keep PHP LDAP support Fix case sensitive sameSite cookie [PropertyInfo] Use rawurlencode to escape PSR-6 keys fix(security): ensure the 'route' index is set before attempting to use it Fix the design of the profiler exceptions when there is no message [Config] Minor fix [WebProfilerBundle] Fix full sized dump hovering in toolbar
2 parents e02ba32 + 444a840 commit 6dc5f59

File tree

12 files changed

+42
-65
lines changed

12 files changed

+42
-65
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: php
22

3+
dist: precise
34
sudo: false
45

56
git:

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/exception.html.twig

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="exception-summary">
1+
<div class="exception-summary {{ exception.message is empty ? 'exception-without-message' }}">
22
<div class="exception-metadata">
33
<div class="container">
44
<h2 class="exception-hierarchy">
@@ -13,9 +13,9 @@
1313
</h2>
1414
</div>
1515
</div>
16-
{% if exception.message is not empty %}
17-
<div class="container">
18-
<div class="exception-message-wrapper">
16+
17+
<div class="exception-message-wrapper">
18+
<div class="container">
1919
<h1 class="break-long-words exception-message {{ exception.message|length > 180 ? 'long' }}">
2020
{{- exception.message|nl2br|format_file_from_text -}}
2121
</h1>
@@ -25,7 +25,6 @@
2525
</div>
2626
</div>
2727
</div>
28-
{% endif %}
2928
</div>
3029

3130
<div class="container">

src/Symfony/Bundle/TwigBundle/Resources/views/exception.css.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ header .container { display: flex; justify-content: space-between; }
7979
.exception-hierarchy .icon { margin: 0 3px; opacity: .7; }
8080
.exception-hierarchy .icon svg { height: 13px; width: 13px; vertical-align: -2px; }
8181

82-
.exception-message-wrapper { display: flex; align-items: flex-start; min-height: 70px; padding: 10px 0 8px; }
82+
.exception-without-message .exception-message-wrapper { display: none; }
83+
.exception-message-wrapper .container { display: flex; align-items: flex-start; min-height: 70px; padding: 10px 0 8px; }
8384
.exception-message { flex-grow: 1; }
8485
.exception-message, .exception-message a { color: #FFF; font-size: 21px; font-weight: 400; margin: 0; }
8586
.exception-message.long { font-size: 18px; }

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
margin: 1em 0;
1717
padding: 10px;
1818
}
19+
.exception-summary.exception-without-message {
20+
display: none;
21+
}
1922

2023
.exception-message {
2124
color: #B0413E;
@@ -26,6 +29,6 @@
2629
display: none;
2730
}
2831

29-
.exception-message-wrapper {
32+
.exception-message-wrapper .container {
3033
min-height: auto;
3134
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,12 @@
380380
100% { background: #222; }
381381
}
382382

383-
.sf-toolbar-block.sf-toolbar-block-dump {
384-
position: static;
385-
}
386-
387383
.sf-toolbar-block.sf-toolbar-block-dump .sf-toolbar-info {
388384
max-width: none;
389-
right: 0;
385+
width: 100%;
386+
position: fixed;
387+
box-sizing: border-box;
388+
left: 0;
390389
}
391390

392391
.sf-toolbar-block-dump pre.sf-dump {

src/Symfony/Component/Config/Resource/ClassExistenceResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private static function throwOnRequiredClass($class)
149149
$props = array(
150150
'file' => $trace[$i]['file'],
151151
'line' => $trace[$i]['line'],
152-
'trace' => array_slice($trace, 0, 1 + $i),
152+
'trace' => array_slice($trace, 1 + $i),
153153
);
154154

155155
foreach ($props as $p => $v) {

src/Symfony/Component/HttpFoundation/Cookie.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom
126126
$this->httpOnly = (bool) $httpOnly;
127127
$this->raw = (bool) $raw;
128128

129+
if (null !== $sameSite) {
130+
$sameSite = strtolower($sameSite);
131+
}
132+
129133
if (!in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) {
130134
throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.');
131135
}

src/Symfony/Component/HttpFoundation/Tests/CookieTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,10 @@ public function testFromStringWithHttpOnly()
214214
$cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure');
215215
$this->assertFalse($cookie->isHttpOnly());
216216
}
217+
218+
public function testSameSiteAttributeIsCaseInsensitive()
219+
{
220+
$cookie = new Cookie('foo', 'bar', 0, '/', null, false, true, false, 'Lax');
221+
$this->assertEquals('lax', $cookie->getSameSite());
222+
}
217223
}

src/Symfony/Component/PropertyInfo/PropertyInfoCacheExtractor.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ private function extract($method, array $arguments)
108108
return call_user_func_array(array($this->propertyInfoExtractor, $method), $arguments);
109109
}
110110

111-
$key = $this->escape($method.'.'.$serializedArguments);
111+
// Calling rawurlencode escapes special characters not allowed in PSR-6's keys
112+
$key = rawurlencode($method.'.'.$serializedArguments);
112113

113114
if (array_key_exists($key, $this->arrayCache)) {
114115
return $this->arrayCache[$key];
@@ -126,29 +127,4 @@ private function extract($method, array $arguments)
126127

127128
return $this->arrayCache[$key] = $value;
128129
}
129-
130-
/**
131-
* Escapes a key according to PSR-6.
132-
*
133-
* Replaces characters forbidden by PSR-6 and the _ char by the _ char followed by the ASCII
134-
* code of the escaped char.
135-
*
136-
* @param string $key
137-
*
138-
* @return string
139-
*/
140-
private function escape($key)
141-
{
142-
return strtr($key, array(
143-
'{' => '_123',
144-
'}' => '_125',
145-
'(' => '_40',
146-
')' => '_41',
147-
'/' => '_47',
148-
'\\' => '_92',
149-
'@' => '_64',
150-
':' => '_58',
151-
'_' => '_95',
152-
));
153-
}
154130
}

src/Symfony/Component/PropertyInfo/Tests/PropertyInfoCacheExtractorTest.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,29 +61,4 @@ public function testGetProperties()
6161
parent::testGetProperties();
6262
parent::testGetProperties();
6363
}
64-
65-
/**
66-
* @dataProvider escapeDataProvider
67-
*/
68-
public function testEscape($toEscape, $expected)
69-
{
70-
$reflectionMethod = new \ReflectionMethod($this->propertyInfo, 'escape');
71-
$reflectionMethod->setAccessible(true);
72-
73-
$this->assertSame($expected, $reflectionMethod->invoke($this->propertyInfo, $toEscape));
74-
}
75-
76-
public function escapeDataProvider()
77-
{
78-
return array(
79-
array('foo_bar', 'foo_95bar'),
80-
array('foo_95bar', 'foo_9595bar'),
81-
array('foo{bar}', 'foo_123bar_125'),
82-
array('foo(bar)', 'foo_40bar_41'),
83-
array('foo/bar', 'foo_47bar'),
84-
array('foo\bar', 'foo_92bar'),
85-
array('foo@bar', 'foo_64bar'),
86-
array('foo:bar', 'foo_58bar'),
87-
);
88-
}
8964
}

0 commit comments

Comments
 (0)