8000 Merge branch '3.3' into 3.4 · symfony/symfony@7582b1a · GitHub
[go: up one dir, main page]

Skip to content

Commit 7582b1a

Browse files
Merge branch '3.3' into 3.4
* 3.3: [VarDumper] Dont use empty(), it chokes on eg GMP objects [Dotenv] Changed preg_match flags from null to 0 remove upgrade instructions for kernel.root_dir [HttpKernel] Arrays with scalar values passed to ESI fragment renderer throw deprecation notice [HttpKernel] add a test for FilterControllerEvents
2 parents ae37c7a + 3366008 commit 7582b1a

File tree

8 files changed

+40
-21
lines changed

8 files changed

+40
-21
lines changed

UPGRADE-3.3.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,6 @@ HttpFoundation
256256
HttpKernel
257257
-----------
258258

259-
* Deprecated the `kernel.root_dir` parameter. Use the new `kernel.project_dir`
260-
parameter instead.
261-
262-
* Deprecated the `Kernel::getRootDir()` method. Use the new `Kernel::getProjectDir()`
263-
method instead.
264-
265259
* The `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` methods have been deprecated and will be removed in 4.0.
266260

267261
* The `Psr6CacheClearer::addPool()` method has been deprecated. Pass an array

UPGRADE-4.0.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,6 @@ HttpKernel
598598
tags: ['console.command']
599599
```
600600
601-
* Removed the `kernel.root_dir` parameter. Use the `kernel.project_dir` parameter
602-
instead.
603-
604-
* Removed the `Kernel::getRootDir()` method. Use the `Kernel::getProjectDir()`
605-
method instead.
606-
607601
* The `Extension::addClassesToCompile()` and `Extension::getClassesToCompile()` methods have been removed.
608602

609603
* Possibility to pass non-scalar values as URI attributes to the ESI and SSI

src/Symfony/Component/Dotenv/Dotenv.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ private function lexVarname()
173173

174174
private function lexValue()
175175
{
176-
if (preg_match('/[ \t]*+(?:#.*)?$/Am', $this->data, $matches, null, $this->cursor)) {
176+
if (preg_match('/[ \t]*+(?:#.*)?$/Am', $this->data, $matches, 0, $this->cursor)) {
177177
$this->moveCursor($matches[0]);
178178
$this->skipEmptyLines();
179179

@@ -295,7 +295,7 @@ private function lexNestedExpression()
295295

296296
private function skipEmptyLines()
297297
{
298-
if (preg_match('/(?:\s*+(?:#[^\n]*+)?+)++/A', $this->data, $match, null, $this->cursor)) {
298+
if (preg_match('/(?:\s*+(?:#[^\n]*+)?+)++/A', $this->data, $match, 0, $this->cursor)) {
299299
$this->moveCursor($match[0]);
300300
}
301301
}

src/Symfony/Component/HttpKernel/Fragment/AbstractSurrogateFragmentRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ private function generateSignedFragmentUri($uri, Request $request)
9898
private function containsNonScalars(array $values)
9999
{
100100
foreach ($values as $value) {
101-
if (is_array($value) && $this->containsNonScalars($value)) {
102-
return true;
101+
if (is_array($value)) {
102+
return $this->containsNonScalars($value);
103103
} elseif (!is_scalar($value) && null !== $value) {
104104
return true;
105105
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Symfony\Component\HttpKernel\Tests\Event;
4+
5+
use Symfony\Component\HttpFoundation\Request;
6+
use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent;
7+
use PHPUnit\Framework\TestCase;
8+
use Symfony\Component\HttpKernel\Tests\TestHttpKernel;
9+
10+
class FilterControllerArgumentsEventTest extends TestCase
11+
{
12+
public function testFilterControllerArgumentsEvent()
13+
{
14+
$filterController = new FilterControllerArgumentsEvent(new TestHttpKernel(), function () {}, array('test'), new Request(), 1);
15+
$this->assertEquals($filterController->getArguments(), array('test'));
16+
}
17+
}

src/Symfony/Component/HttpKernel/Tests/Fragment/EsiFragmentRendererTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ public function testRenderFallbackWithObjectAttributesIsDeprecated()
3434
{
3535
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
3636
$request = Request::create('/');
37-
$reference = new ControllerReference('main_controller', array('foo' => array('a' => array(), 'b' => new \stdClass())), array());
37+
$reference = new ControllerReference('main_controller', array('foo' => new \stdClass()), array());
38+
$strategy->render($reference, $request);
39+
}
40+
41+
public function testRenderFallbackWithScalarIsNotDeprecated()
42+
{
43+
$strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo'));
44+
$request = Request::create('/');
45+
$reference = new ControllerReference('main_controller', array('foo' => array(true)), array());
3846
$strategy->render($reference, $request);
3947
}
4048

src/Symfony/Component/VarDumper/Caster/Caster.php

Expand all lines: src/Symfony/Component/VarDumper/Caster/Caster.php
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ public static function filter(array $a, $filter, array $listedProperties = array
118118

119119
if (null === $v) {
120120
$type |= self::EXCLUDE_NULL & $filter;
121-
}
122-
if (empty($v)) {
121+
$type |= self::EXCLUDE_EMPTY & $filter;
122+
} elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || array() === $v) {
123123
$type |= self::EXCLUDE_EMPTY & $filter;
124124
}
125125
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) {

src/Symfony/Component/VarDumper/Cloner/VarCloner.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,16 @@ protected function doClone($var)
107107
// Create $stub when the original value $v can not be used directly
108108
// If $v is a nested structure, put that structure in array $a
109109
switch (true) {
110-
case empty($v):
111-
case true === $v:
110+
case null === $v:
111+
case \is_bool($v):
112112
case \is_int($v):
113113
case \is_float($v):
114114
continue 2;
115115

116116
case \is_string($v):
117+
if ('' === $v) {
118+
continue 2;
119+
}
117120
if (!\preg_match('//u', $v)) {
118121
$stub = new Stub();
119122
$stub->type = Stub::TYPE_STRING;
@@ -137,6 +140,9 @@ protected function doClone($var)
137140
break;
138141

139142
case \is_array($v):
143+
if (!$v) {
144+
continue 2;
145+
}
140146
$stub = $arrayStub;
141147
$stub->class = Stub::ARRAY_INDEXED;
142148

0 commit comments

Comments
 (0)
0