Skip to content

Commit 7e2fbe1

Browse files
committed
Merge branch '4.2'
* 4.2: fixed bad merge Show more accurate message in profiler when missing stopwatch CS Fixes: Not double split with one array argument [Serializer] Add default object class resolver Remove redundant animation prefixes Remove redundant `box-sizing` prefixes [VarExporter] support PHP7.4 __serialize & __unserialize Rework firewall access denied rule MetadataAwareNameConverter: Do not assume that property names are strings [VarExporter] fix exporting classes with private constructors fixed CS Fix missing $extraDirs when open_basedir returns
2 parents b6c6338 + 9ee6fc1 commit 7e2fbe1

File tree

26 files changed

+317
-141
lines changed

26 files changed

+317
-141
lines changed

src/Symfony/Bundle/SecurityBundle/Tests/Functional/UserPasswordEncoderCommandTest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,12 @@ public function testEncodePasswordOutput()
150150

151151
public function testEncodePasswordEmptySaltOutput()
152152
{
153-
$this->passwordEncoderCommandTester->execute(
154-
[
155-
'command' => 'security:encode-password',
156-
'password' => 'p@ssw0rd',
157-
'user-class' => 'Symfony\Component\Security\Core\User\User',
158-
'--empty-salt' => true,
159-
]
160-
);
153+
$this->passwordEncoderCommandTester->execute([
154+
'command' => 'security:encode-password',
155+
'password' => 'p@ssw0rd',
156+
'user-class' => 'Symfony\Component\Security\Core\User\User',
157+
'--empty-salt' => true,
158+
]);
161159

162160
$this->assertContains('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay());
163161
$this->assertContains(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay());

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@
9393

9494
<h2>Execution timeline</h2>
9595

96-
{% if collector.events is empty %}
96+
{% if not collector.isStopwatchInstalled() %}
97+
<div class="empty">
98+
<p>The Stopwatch component is not installed. If you want to see timing events, run: <code>composer require symfony/stopwatch</code>.</p>
99+
</div>
100+
{% elseif collector.events is empty %}
97101
<div class="empty">
98102
<p>No timing events have been recorded. Check that symfony/stopwatch is installed and debugging enabled in the kernel.</p>
99103
</div>

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
background-color: #222;
66
border-top-left-radius: 4px;
77
bottom: 0;
8-
-webkit-box-sizing: border-box;
9-
-moz-box-sizing: border-box;
108
box-sizing: border-box;
119
display: none;
1210
height: 36px;
@@ -36,8 +34,6 @@
3634
}
3735

3836
.sf-toolbarreset * {
39-
-webkit-box-sizing: content-box;
40-
-moz-box-sizing: content-box;
4137
box-sizing: content-box;
4238
vertical-align: baseline;
4339
letter-spacing: normal;
@@ -371,21 +367,8 @@ div.sf-toolbar .sf-toolbar-block a:hover {
371367
text-align: right;
372368
}
373369
.sf-ajax-request-loading {
374-
-webkit-animation: sf-blink .5s ease-in-out infinite;
375-
-o-animation: sf-blink .5s ease-in-out infinite;
376-
-moz-animation: sf-blink .5s ease-in-out infinite;
377370
animation: sf-blink .5s ease-in-out infinite;
378371
}
379-
@-webkit-keyframes sf-blink {
380-
0% { background: #222; }
381-
50% { background: #444; }
382-
100% { background: #222; }
383-
}
384-
@-moz-keyframes sf-blink {
385-
0% { background: #222; }
386-
50% { background: #444; }
387-
100% { background: #222; }
388-
}
389372
@keyframes sf-blink {
390373
0% { background: #222; }
391374
50% { background: #444; }

src/Symfony/Component/Form/Extension/Core/Type/DateIntervalType.php

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -205,38 +205,36 @@ public function configureOptions(OptionsResolver $resolver)
205205
}));
206206
};
207207

208-
$resolver->setDefaults(
209-
[
210-
'with_years' => true,
211-
'with_months' => true,
212-
'with_days' => true,
213-
'with_weeks' => false,
214-
'with_hours' => false,
215-
'with_minutes' => false,
216-
'with_seconds' => false,
217-
'with_invert' => false,
218-
'years' => range(0, 100),
219-
'months' => range(0, 12),
220-
'weeks' => range(0, 52),
221-
'days' => range(0, 31),
222-
'hours' => range(0, 24),
223-
'minutes' => range(0, 60),
224-
'seconds' => range(0, 60),
225-
'widget' => 'choice',
226-
'input' => 'dateinterval',
227-
'placeholder' => $placeholderDefault,
228-
'by_reference' => true,
229-
'error_bubbling' => false,
230-
// If initialized with a \DateInterval object, FormType initializes
231-
// this option to "\DateInterval". Since the internal, normalized
232-
// representation is not \DateInterval, but an array, we need to unset
233-
// this option.
234-
'data_class' => null,
235-
'compound' => $compound,
236-
'empty_data' => $emptyData,
237-
'labels' => [],
238-
]
239-
);
208+
$resolver->setDefaults([
209+
'with_years' => true,
210+
'with_months' => true,
211+
'with_days' => true,
212+
'with_weeks' => false,
213+
'with_hours' => false,
214+
'with_minutes' => false,
215+
'with_seconds' => false,
216+
'with_invert' => false,
217+
'years' => range(0, 100),
218+
'months' => range(0, 12),
219+
'weeks' => range(0, 52),
220+
'days' => range(0, 31),
221+
'hours' => range(0, 24),
222+
'minutes' => range(0, 60),
223+
'seconds' => range(0, 60),
224+
'widget' => 'choice',
225+
'input' => 'dateinterval',
226+
'placeholder' => $placeholderDefault,
227+
'by_reference' => true,
228+
'error_bubbling' => false,
229+
// If initialized with a \DateInterval object, FormType initializes
230+
// this option to "\DateInterval". Since the internal, normalized
231+
// representation is not \DateInterval, but an array, we need to unset
232+
// this option.
233+
'data_class' => null,
234+
'compound' => $compound,
235+
'empty_data' => $emptyData,
236+
'labels' => [],
237+
]);
240238
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
241239
$resolver->setNormalizer('labels', $labelsNormalizer);
242240

src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,10 @@ function ($object) { return $object->value; }
149149

150150
public function testCreateFromChoicesGrouped()
151151
{
152-
$list = $this->factory->createListFromChoices(
153-
[
154-
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
155-
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
156-
]
157-
);
152+
$list = $this->factory->createListFromChoices([
153+
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
154+
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
155+
]);
158156

159157
$this->assertObjectListWithGeneratedValues($list);
160158
}

src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function collect(Request $request, Response $response, \Exception $except
4747
'token' => $response->headers->get('X-Debug-Token'),
4848
'start_time' => $startTime * 1000,
4949
'events' => [],
50+
'stopwatch_installed' => \class_exists(Stopwatch::class, false),
5051
];
5152
}
5253

@@ -139,6 +140,14 @@ public function getStartTime()
139140
return $this->data['start_time'];
140141
}
141142

143+
/**
144+
* @return bool whether or not the stopwatch component is installed
145+
*/
146+
public function isStopwatchInstalled()
147+
{
148+
return $this->data['stopwatch_installed'];
149+
}
150+
142151
/**
143152
* {@inheritdoc}
144153
*/

src/Symfony/Component/HttpKernel/Tests/DataCollector/TimeDataCollectorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector;
18+
use Symfony\Component\Stopwatch\Stopwatch;
1819

1920
/**
2021
* @group time-sensitive
@@ -51,5 +52,6 @@ public function testCollect()
5152

5253
$c->collect($request, new Response());
5354
$this->assertEquals(123456000, $c->getStartTime());
55+
$this->assertSame(\class_exists(Stopwatch::class, false), $c->isStopwatchInstalled());
5456
}
5557
}

src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -851,13 +851,11 @@ public function testResolveFailsWithCorrectLevelsButWrongScalar()
851851
$this->resolver->setDefined('foo');
852852
$this->resolver->setAllowedTypes('foo', 'int[][]');
853853

854-
$this->resolver->resolve(
855-
[
856-
'foo' => [
857-
[1.2],
858-
],
859-
]
860-
);
854+
$this->resolver->resolve([
855+
'foo' => [
856+
[1.2],
857+
],
858+
]);
861859
}
862860

863861
/**
@@ -1975,13 +1973,11 @@ public function testNestedArrays()
19751973
1, 2,
19761974
],
19771975
],
1978-
], $this->resolver->resolve(
1979-
[
1980-
'foo' => [
1981-
[1, 2],
1982-
],
1983-
]
1984-
));
1976+
], $this->resolver->resolve([
1977+
'foo' => [
1978+
[1, 2],
1979+
],
1980+
]));
19851981
}
19861982

19871983
public function testNested2Arrays()
@@ -2021,17 +2017,15 @@ public function testNestedArraysException()
20212017
$this->resolver->setDefined('foo');
20222018
$this->resolver->setAllowedTypes('foo', 'float[][][][]');
20232019

2024-
$this->resolver->resolve(
2025-
[
2026-
'foo' => [
2020+
$this->resolver->resolve([
2021+
'foo' => [
2022+
[
20272023
[
2028-
[
2029-
[1, 2],
2030-
],
2024+
[1, 2],
20312025
],
20322026
],
2033-
]
2034-
);
2027+
],
2028+
]);
20352029
}
20362030

20372031
/**

src/Symfony/Component/Process/ExecutableFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function addSuffix($suffix)
5151
public function find($name, $default = null, array $extraDirs = [])
5252
{
5353
if (ini_get('open_basedir')) {
54-
$searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
54+
$searchPath = array_merge(explode(PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs);
5555
$dirs = [];
5656
foreach ($searchPath as $path) {
5757
// Silencing against https://bugs.php.net/69240

src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ private function handleAccessDeniedException(GetResponseForExceptionEvent $event
133133
} catch (\Exception $e) {
134134
$event->setException($e);
135135
}
136-
137-
return;
138136
}
139137

140138
if (null !== $this->logger) {
@@ -152,7 +150,7 @@ private function handleAccessDeniedException(GetResponseForExceptionEvent $event
152150
$subRequest = $this->httpUtils->createRequest($event->getRequest(), $this->errorPage);
153151
$subRequest->attributes->set(Security::ACCESS_DENIED_ERROR, $exception);
154152

155-
$event->setResponse($event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true));
153+
$event->setResponse($event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST));
156154
$event->allowCustomResponseCode();
157155
}
158156
} catch (\Exception $e) {

0 commit comments

Comments
 (0)