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

Appearance settings

Commit 643c54c

Browse filesBrowse files
Merge branch '3.4'
* 3.4: [DI] use assertStringEqualsFile when possible [VarDumper] Adapt to php 7.2 changes [DI] Fix using private services in expressions [Form][TwigBridge] Don't render _method in form_rest() for a child form [Form] Static call TimezoneType::getTimezones Removed references for non existent validator constraints Suggest using quotes instead of Yaml::PARSE_KEYS_AS_STRINGS [DI] Fix test [Cache] Handle unserialization failures for Memcached Remove unused prop + added @deprecated Remove unused mocks/vars feature #22317 [Console] Make SymfonyQuestionHelper::ask optional by default (ro0NL) [DoctrineBridge][PropertyInfo] Added support for Doctrine Embeddables [Validator] Fix IbanValidator for ukrainian IBANs Router: allow HEAD method to be defined first [WebProfilerBundle] Display trace and context in the logger profiler Fixing a bug where if a core class was autowired, autowiring tried to autowire optional args as if they were required
2 parents e6f6150 + 4a3b3be commit 643c54c
Copy full SHA for 643c54c

File tree

Expand file treeCollapse file tree

38 files changed

+424
-94
lines changed
Filter options
Expand file treeCollapse file tree

38 files changed

+424
-94
lines changed

‎UPGRADE-3.3.md

Copy file name to clipboardExpand all lines: UPGRADE-3.3.md
+5-8Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,16 +367,14 @@ Yaml
367367

368368
* Deprecated support for implicitly parsing non-string mapping keys as strings.
369369
Mapping keys that are no strings will lead to a `ParseException` in Symfony
370-
4.0. Use the `PARSE_KEYS_AS_STRINGS` flag to opt-in for keys to be parsed as
371-
strings.
370+
4.0. Use quotes to opt-in for keys to be parsed as strings.
372371

373372
Before:
374373

375374
```php
376375
$yaml = <<<YAML
377376
null: null key
378377
true: boolean true
379-
1: integer key
380378
2.0: float key
381379
YAML;
382380

@@ -388,13 +386,12 @@ Yaml
388386
```php
389387

390388
$yaml = <<<YAML
391-
null: null key
392-
true: boolean true
393-
1: integer key
394-
2.0: float key
389+
"null": null key
390+
"true": boolean true
391+
"2.0": float key
395392
YAML;
396393

397-
Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS);
394+
Yaml::parse($yaml);
398395
```
399396

400397
* Omitting the key of a mapping is deprecated and will throw a `ParseException` in Symfony 4.0.

‎UPGRADE-4.0.md

Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+10-12Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,13 @@ FrameworkBundle
336336
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ValidateWorkflowsPass` class
337337
has been removed. Use the `Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass`
338338
class instead.
339-
339+
340340
* Using the `KERNEL_DIR` environment variable and the automatic guessing based
341341
on the `phpunit.xml` file location have been removed from the `KernelTestCase::getKernelClass()`
342342
method implementation. Set the `KERNEL_CLASS` environment variable to the
343343
fully-qualified class name of your Kernel or override the `KernelTestCase::createKernel()`
344344
or `KernelTestCase::getKernelClass()` method instead.
345-
345+
346346
* The methods `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()`
347347
have been removed.
348348

@@ -560,10 +560,10 @@ TwigBridge
560560

561561
* The `TwigRendererEngine::setEnvironment()` method has been removed.
562562
Pass the Twig Environment as second argument of the constructor instead.
563-
563+
564564
* Removed `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability
565565
to pass a command name as first argument.
566-
566+
567567
* Removed `Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironment` and the ability
568568
to pass a command name as first argument.
569569

@@ -670,16 +670,15 @@ Yaml
670670
throws a `ParseException`.
671671

672672
* Removed support for implicitly parsing non-string mapping keys as strings.
673-
Mapping keys that are no strings will result in a `ParseException`. Use the
674-
`PARSE_KEYS_AS_STRINGS` flag to opt-in for keys to be parsed as strings.
673+
Mapping keys that are no strings will result in a `ParseException`. Use
674+
quotes to opt-in for keys to be parsed as strings.
675675

676676
Before:
677677

678678
```php
679679
$yaml = <<<YAML
680680
null: null key
681681
true: boolean true
682-
1: integer key
683682
2.0: float key
684683
YAML;
685684

@@ -691,13 +690,12 @@ Yaml
691690
```php
692691

693692
$yaml = <<<YAML
694-
null: null key
695-
true: boolean true
696-
1: integer key
697-
2.0: float key
693+
"null": null key
694+
"true": boolean true
695+
"2.0": float key
698696
YAML;
699697

700-
Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS);
698+
Yaml::parse($yaml);
701699
```
702700

703701
* Omitting the key of a mapping is not supported anymore and throws a `ParseException`.

‎src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+15-1Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ public function getProperties($class, array $context = array())
5050
return;
5151
}
5252

53-
return array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
53+
$properties = array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
54+
55+
if ($metadata instanceof ClassMetadataInfo && class_exists('Doctrine\ORM\Mapping\Embedded') && $metadata->embeddedClasses) {
56+
$properties = array_filter($properties, function ($property) {
57+
return false === strpos($property, '.');
58+
});
59+
60+
$properties = array_merge($properties, array_keys($metadata->embeddedClasses));
61+
}
62+
63+
return $properties;
5464
}
5565

5666
/**
@@ -105,6 +115,10 @@ public function getTypes($class, $property, array $context = array())
105115
));
106116
}
107117

118+
if ($metadata instanceof ClassMetadataInfo && class_exists('Doctrine\ORM\Mapping\Embedded') && isset($metadata->embeddedClasses[$property])) {
119+
return array(new Type(Type::BUILTIN_TYPE_OBJECT, false, $metadata->embeddedClasses[$property]['class']));
120+
}
121+
108122
if ($metadata->hasField($property)) {
109123
$typeOfField = $metadata->getTypeOfField($property);
110124
$nullable = $metadata instanceof ClassMetadataInfo && $metadata->isNullable($property);

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ public function testGetProperties()
6666
);
6767
}
6868

69+
public function testGetPropertiesWithEmbedded()
70+
{
71+
if (!class_exists('Doctrine\ORM\Mapping\Embedded')) {
72+
$this->markTestSkipped('@Embedded is not available in Doctrine ORM lower than 2.5.');
73+
}
74+
75+
$this->assertEquals(
76+
array(
77+
'id',
78+
'embedded',
79+
),
80+
$this->extractor->getProperties('Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineWithEmbedded')
81+
);
82+
}
83+
6984
/**
7085
* @dataProvider typesProvider
7186
*/
@@ -74,6 +89,27 @@ public function testExtract($property, array $type = null)
7489
$this->assertEquals($type, $this->extractor->getTypes('Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineDummy', $property, array()));
7590
}
7691

92+
public function testExtractWithEmbedded()
93+
{
94+
if (!class_exists('Doctrine\ORM\Mapping\Embedded')) {
95+
$this->markTestSkipped('@Embedded is not available in Doctrine ORM lower than 2.5.');
96+
}
97+
98+
$expectedTypes = array(new Type(
99+
Type::BUILTIN_TYPE_OBJECT,
100+
false,
101+
'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineEmbeddable'
102+
));
103+
104+
$actualTypes = $this->extractor->getTypes(
105+
'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineWithEmbedded',
106+
'embedded',
107+
array()
108+
);
109+
110+
$this->assertEquals($expectedTypes, $actualTypes);
111+
}
112+
77113
public function typesProvider()
78114
{
79115
return array(
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures;
13+
14+
use Doctrine\ORM\Mapping\Column;
15+
use Doctrine\ORM\Mapping\Embeddable;
16+
17+
/**
18+
* @Embeddable
19+
*
20+
* @author Udaltsov Valentin <udaltsov.valentin@gmail.com>
21+
*/
22+
class DoctrineEmbeddable
23+
{
24+
/**
25+
* @Column(type="string")
26+
*/
27+
protected $field;
28+
}
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures;
13+
14+
use Doctrine\ORM\Mapping\Column;
15+
use Doctrine\ORM\Mapping\Entity;
16+
use Doctrine\ORM\Mapping\Id;
17+
use Doctrine\ORM\Mapping\Embedded;
18+
19+
/**
20+
* @Entity
21+
*
22+
* @author Udaltsov Valentin <udaltsov.valentin@gmail.com>
23+
*/
24+
class DoctrineWithEmbedded
25+
{
26+
/**
27+
* @Id
28+
* @Column(type="smallint")
29+
*/
30+
public $id;
31+
32+
/**
33+
* @Embedded(class="DoctrineEmbeddable")
34+
*/
35+
protected $embedded;
36+
}

‎src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
{% endif %}
340340
{%- endfor %}
341341

342-
{% if not form.methodRendered %}
342+
{% if not form.methodRendered and form.parent is null %}
343343
{%- do form.setMethodRendered() -%}
344344
{% set method = method|upper %}
345345
{%- if method in ["GET", "POST"] -%}

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterDebugCommandTest.php
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ private function getKernel()
7171
->will($this->returnValue($routeCollection))
7272
;
7373

74-
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader')
75-
->disableOriginalConstructor()
76-
->getMock();
77-
7874
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
7975
$container
8076
->expects($this->atLeastOnce())

‎src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ private function getKernel()
7070
->will($this->returnValue($requestContext))
7171
;
7272

73-
$loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader')
74-
->disableOriginalConstructor()
75-
->getMock();
76-
7773
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
7874
$container
7975
->expects($this->atLeastOnce())

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolClearCommandTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
*/
2020
class CachePoolClearCommandTest extends WebTestCase
2121
{
22-
private $application;
23-
2422
protected function setUp()
2523
{
2624
static::bootKernel(array('test_case' => 'CachePoolClear', 'root_config' => 'config.yml'));

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testParametersValuesAreResolved()
6161
public function testDumpUndefinedBundleOption()
6262
{
6363
$tester = $this->createCommandTester();
64-
$ret = $tester->execute(array('name' => 'TestBundle', 'path' => 'foo'));
64+
$tester->execute(array('name' => 'TestBundle', 'path' => 'foo'));
6565

6666
$this->assertContains('Unable to find configuration for "test.foo"', $tester->getDisplay());
6767
}

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
+22-20Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -224,31 +224,33 @@
224224
{% endmacro %}
225225

226226
{% macro render_log_message(category, log_index, log) %}
227-
{% if log.context.exception.trace is defined %}
228-
{{ profiler_dump_log(log.message, log.context) }}
229-
230-
{% set context_id = 'context-' ~ category ~ '-' ~ log_index %}
227+
{% set has_context = log.context is defined and log.context is not empty %}
228+
{% set has_trace = log.context.exception.trace is defined %}
231229

232-
<span class="metadata">
233-
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="Hide trace">Show trace</a>
234-
235-
<div id="{{ context_id }}" class="context sf-toggle-content sf-toggle-hidden">
236-
{{ profiler_dump(log.context.exception.trace, maxDepth=1) }}
237-
</div>
238-
</span>
239-
{% elseif log.context is defined and log.context is not empty %}
230+
{% if not has_context %}
231+
{{ profiler_dump_log(log.message) }}
232+
{% else %}
240233
{{ profiler_dump_log(log.message, log.context) }}
241234

242-
{% set context_id = 'context-' ~ category ~ '-' ~ log_index %}
235+
<div class="text-small font-normal">
236+
{% set context_id = 'context-' ~ category ~ '-' ~ log_index %}
237+
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="Hide context">Show context</a>
243238

244-
<span class="metadata">
245-
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="Hide context">Show context</a>
239+
{% if has_trace %}
240+
&nbsp;&nbsp;
241+
{% set trace_id = 'trace-' ~ category ~ '-' ~ log_index %}
242+
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ trace_id }}" data-toggle-alt-content="Hide trace">Show trace</a>
243+
{% endif %}
244+
</div>
245+
246+
<div id="{{ context_id }}" class="context sf-toggle-content sf-toggle-hidden">
247+
{{ profiler_dump(log.context, maxDepth=1) }}
248+
</div>
246249

247-
<div id="{{ context_id }}" class="context sf-toggle-content sf-toggle-hidden">
248-
{{ profiler_dump(log.context, maxDepth=1) }}
250+
{% if has_trace %}
251+
<div id="{{ trace_id }}" class="context sf-toggle-content sf-toggle-hidden">
252+
{{ profiler_dump(log.context.exception.trace, maxDepth=1) }}
249253
</div>
250-
</span>
251-
{% else %}
252-
{{ profiler_dump_log(log.message) }}
254+
{% endif %}
253255
{% endif %}
254256
{% endmacro %}

‎src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/MemcachedTrait.php
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ trait MemcachedTrait
2626
'persistent_id' => null,
2727
'username' => null,
2828
'password' => null,
29+
'serializer' => 'php',
2930
);
3031

3132
private $client;
@@ -194,7 +195,14 @@ protected function doSave(array $values, $lifetime)
194195
*/
195196
protected function doFetch(array $ids)
196197
{
197-
return $this->checkResultCode($this->client->getMulti($ids));
198+
$unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');
199+
try {
200+
return $this->checkResultCode($this->client->getMulti($ids));
201+
} catch (\Error $e) {
202+
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
203+
} finally {
204+
ini_set('unserialize_callback_func', $unserializeCallbackHandler);
205+
}
198206
}
199207

200208
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.