Skip to content

Commit 726ad26

Browse files
Merge branch '3.2'
* 3.2: (51 commits) [FrameworkBundle] [Workflow] Fix service marking store configuration Fix merge [Validator] add class name to the cache key [Serializer] Remove AbstractObjectNormalizer::isAttributeToNormalize Throw less misleading exception when property access not found [Twig] Fix deprecations with Twig 1.29 [FrameworkBundle] Fix validation cache warmer with failing or missing classes Fixed typo [FrameworkBundle] Removed the kernel.debug parameter from the cache pool namespace seed Fix email address fix the docblock in regard to the role argument [Bridge\Twig] Trigger deprecation when using FormExtension::$renderer Don't use the "app" global variable in the profiler [VarDumper] fix tests when xdebug is enabled Fix merge FIXED NON EXISTING TYPE DECLARATION [Form] Add failing test for data collector bug [Cache] Fix dumping SplDoublyLinkedList iter mode [Form] Fix FormDataCollector Ignore missing 'debug.file_link_formatter' service in Debug and Twig bundles ...
2 parents 9091a82 + 8e6023b commit 726ad26

File tree

90 files changed

+1010
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1010
-293
lines changed

CHANGELOG-3.2.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ in 3.2 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.2.0...v3.2.1
99

10+
* 3.2.0 (2016-11-30)
11+
12+
* bug #20687 [FrameworkBundle] Forbid env parameters in routing configuration (nicolas-grekas)
13+
* bug #20607 [Validator] Bring egulias/email-validator ~2.0 to parity with ~1.2 (Lctrs)
14+
* bug #20671 [Config] ConfigCache::isFresh() should return false when unserialize() fails (nicolas-grekas)
15+
* bug #20679 [VarDumper] Use default color for ellipsed namespaces/paths (nicolas-grekas)
16+
* bug #20676 [ClassLoader] Use only forward slashes in generated class map (nicolas-grekas)
17+
* bug #20664 [Validator] ensure the proper context for nested validations (xabbuh)
18+
* bug #20661 bug #20653 [WebProfilerBundle] Profiler includes ghost panels (jzawadzki)
19+
* bug #20652 Fixed getRouteParams() when no parameters are available (wouterj)
20+
1021
* 3.2.0-RC2 (2016-11-27)
1122

1223
* bug #20601 [FrameworkBundle] Don't rely on any parent definition for "cache.annotations" (nicolas-grekas)

UPGRADE-3.1.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ Serializer
111111
deprecated and will not be supported in Symfony 4.0. You should use the
112112
`CacheClassMetadataFactory` class instead.
113113

114+
* The `AbstractObjectNormalizer::isAttributeToNormalize()` method has been removed
115+
because it was initially added by mistake, has never been used and is not tested
116+
nor documented.
117+
114118
Translation
115119
-----------
116120

UPGRADE-3.2.md

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,6 @@ BrowserKit
66

77
* Client HTTP user agent has been changed to 'Symfony BrowserKit' (was 'Symfony2 BrowserKit' before).
88

9-
FrameworkBundle
10-
---------------
11-
12-
* The `doctrine/annotations` dependency has been removed; require it via `composer
13-
require doctrine/annotations` if you are using annotations in your project
14-
* The `symfony/security-core` and `symfony/security-csrf` dependencies have
15-
been removed; require them via `composer require symfony/security-core
16-
symfony/security-csrf` if you depend on them and don't already depend on
17-
`symfony/symfony`
18-
* The `symfony/templating` dependency has been removed; require it via `composer
19-
require symfony/templating` if you depend on it and don't already depend on
20-
`symfony/symfony`
21-
* The `symfony/translation` dependency has been removed; require it via `composer
22-
require symfony/translation` if you depend on it and don't already depend on
23-
`symfony/symfony`
24-
* The `symfony/asset` dependency has been removed; require it via `composer
25-
require symfony/asset` if you depend on it and don't already depend on
26-
`symfony/symfony`
27-
* The `Resources/public/images/*` files have been removed.
28-
* The `Resources/public/css/*.css` files have been removed (they are now inlined
29-
in TwigBundle).
30-
319
Console
3210
-------
3311

@@ -72,25 +50,26 @@ Form
7250
FrameworkBundle
7351
---------------
7452

53+
* The `doctrine/annotations` dependency has been removed; require it via `composer
54+
require doctrine/annotations` if you are using annotations in your project
55+
* The `symfony/security-core` and `symfony/security-csrf` dependencies have
56+
been removed; require them via `composer require symfony/security-core
57+
symfony/security-csrf` if you depend on them and don't already depend on
58+
`symfony/symfony`
59+
* The `symfony/templating` dependency has been removed; require it via `composer
60+
require symfony/templating` if you depend on it and don't already depend on
61+
`symfony/symfony`
62+
* The `symfony/translation` dependency has been removed; require it via `composer
63+
require symfony/translation` if you depend on it and don't already depend on
64+
`symfony/symfony`
65+
* The `symfony/asset` dependency has been removed; require it via `composer
66+
require symfony/asset` if you depend on it and don't already depend on
67+
`symfony/symfony`
68+
* The `Resources/public/images/*` files have been removed.
69+
* The `Resources/public/css/*.css` files have been removed (they are now inlined
70+
in TwigBundle).
7571
* The service `serializer.mapping.cache.doctrine.apc` is deprecated. APCu should now
7672
be automatically used when available.
77-
78-
HttpKernel
79-
----------
80-
81-
* `DataCollector::varToString()` is deprecated and will be removed in Symfony
82-
4.0. Use the `cloneVar()` method instead.
83-
84-
* Surrogate name in a `Surrogate-Capability` HTTP request header has been changed to 'symfony'.
85-
86-
Before:
87-
```
88-
Surrogate-Capability: symfony2="ESI/1.0"
89-
```
90-
91-
After:
92-
```
93-
Surrogate-Capability: symfony="ESI/1.0"
9473
```
9574
9675
HttpFoundation
@@ -116,6 +95,30 @@ HttpFoundation
11695
- `isInvalid`/`isSuccessful`/`isRedirection`/`isClientError`/`isServerError`
11796
- `isOk`/`isForbidden`/`isNotFound`/`isRedirect`/`isEmpty`
11897
98+
HttpKernel
99+
----------
100+
101+
* `DataCollector::varToString()` is deprecated and will be removed in Symfony
102+
4.0. Use the `cloneVar()` method instead.
103+
104+
* Surrogate name in a `Surrogate-Capability` HTTP request header has been changed to 'symfony'.
105+
106+
Before:
107+
```
108+
Surrogate-Capability: symfony2="ESI/1.0"
109+
```
110+
111+
After:
112+
```
113+
Surrogate-Capability: symfony="ESI/1.0"
114+
115+
Serializer
116+
----------
117+
118+
* Method `AbstractNormalizer::instantiateObject()` will have a 6th
119+
`$format = null` argument in Symfony 4.0. Not defining it when overriding
120+
the method is deprecated.
121+
119122
TwigBridge
120123
----------
121124

UPGRADE-4.0.md

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ Serializer
182182
* The ability to pass a Doctrine `Cache` instance to the `ClassMetadataFactory`
183183
class has been removed. You should use the `CacheClassMetadataFactory` class
184184
instead.
185+
186+
* Not defining the 6th argument `$format = null` of the
187+
`AbstractNormalizer::instantiateObject()` method when overriding it is not
188+
supported anymore.
185189

186190
Translation
187191
-----------
@@ -194,6 +198,42 @@ TwigBridge
194198
* The possibility to inject the Form Twig Renderer into the form extension
195199
has been removed. Inject it into the `TwigRendererEngine` instead.
196200

201+
Validator
202+
---------
203+
204+
* The `DateTimeValidator::PATTERN` constant was removed.
205+
206+
* `Tests\Constraints\AbstractConstraintValidatorTest` has been removed in
207+
favor of `Test\ConstraintValidatorTestCase`.
208+
209+
Before:
210+
211+
```php
212+
// ...
213+
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
214+
215+
class MyCustomValidatorTest extends AbstractConstraintValidatorTest
216+
{
217+
// ...
218+
}
219+
```
220+
221+
After:
222+
223+
```php
224+
// ...
225+
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
226+
227+
class MyCustomValidatorTest extends ConstraintValidatorTestCase
228+
{
229+
// ...
230+
}
231+
```
232+
233+
* The default value of the strict option of the `Choice` Constraint has been
234+
changed to `true` as of 4.0. If you need the the previous behaviour ensure to
235+
set the option to `false`.
236+
197237
Yaml
198238
----
199239

@@ -285,39 +325,3 @@ Yaml
285325
the `!php/object` tag.
286326

287327
* Duplicate mapping keys lead to a `ParseException`.
288-
289-
Validator
290-
---------
291-
292-
* The `DateTimeValidator::PATTERN` constant was removed.
293-
294-
* `Tests\Constraints\AbstractConstraintValidatorTest` has been removed in
295-
favor of `Test\ConstraintValidatorTestCase`.
296-
297-
Before:
298-
299-
```php
300-
// ...
301-
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
302-
303-
class MyCustomValidatorTest extends AbstractConstraintValidatorTest
304-
{
305-
// ...
306-
}
307-
```
308-
309-
After:
310-
311-
```php
312-
// ...
313-
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
314-
315-
class MyCustomValidatorTest extends ConstraintValidatorTestCase
316-
{
317-
// ...
318-
}
319-
```
320-
321-
* The default value of the strict option of the `Choice` Constraint has been
322-
changed to `true` as of 4.0. If you need the the previous behaviour ensure to
323-
set the option to `false`.

src/Symfony/Bridge/Twig/Extension/FormExtension.php

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser;
1515
use Symfony\Bridge\Twig\Form\TwigRendererInterface;
16+
use Symfony\Component\DependencyInjection\ContainerInterface;
1617
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
1718

1819
/**
@@ -23,12 +24,17 @@
2324
*/
2425
class FormExtension extends \Twig_Extension implements \Twig_Extension_InitRuntimeInterface
2526
{
27+
/**
28+
* @deprecated since version 3.2, to be removed in 4.0 alongside with magic methods below
29+
*/
2630
private $renderer;
2731

28-
public function __construct(TwigRendererInterface $renderer = null)
32+
public function __construct($renderer = null)
2933
{
30-
if (null !== $this->renderer) {
34+
if ($this->renderer instanceof TwigRendererInterface) {
3135
@trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since version 3.2 and won\'t be possible in 4.0. Pass the Twig_Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED);
36+
} elseif (null !== $renderer && !(is_array($renderer) && isset($renderer[0], $renderer[1]) && $renderer[0] instanceof ContainerInterface)) {
37+
throw new \InvalidArgumentException(sprintf('Passing any arguments the constructor of %s is reserved for internal use.', __CLASS__));
3238
}
3339
$this->renderer = $renderer;
3440
}
@@ -40,8 +46,10 @@ public function __construct(TwigRendererInterface $renderer = null)
4046
*/
4147
public function initRuntime(\Twig_Environment $environment)
4248
{
43-
if (null !== $this->renderer) {
49+
if ($this->renderer instanceof TwigRendererInterface) {
4450
$this->renderer->setEnvironment($environment);
51+
} elseif (null !== $this->renderer) {
52+
$this->renderer[2] = $environment;
4553
}
4654
}
4755

@@ -94,6 +102,62 @@ public function getTests()
94102
);
95103
}
96104

105+
/**
106+
* @internal
107+
*/
108+
public function __get($name)
109+
{
110+
if ('renderer' === $name) {
111+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
112+
113+
if (is_array($this->renderer)) {
114+
$renderer = $this->renderer[0]->get($this->renderer[1]);
115+
if (isset($this->renderer[2])) {
116+
$renderer->setEnvironment($this->renderer[2]);
117+
}
118+
$this->renderer = $renderer;
119+
}
120+
}
121+
122+
return $this->$name;
123+
}
124+
125+
/**
126+
* @internal
127+
*/
128+
public function __set($name, $value)
129+
{
130+
if ('renderer' === $name) {
131+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
132+
}
133+
134+
$this->$name = $value;
135+
}
136+
137+
/**
138+
* @internal
139+
*/
140+
public function __isset($name)
141+
{
142+
if ('renderer' === $name) {
143+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
144+
}
145+
146+
return isset($this->$name);
147+
}
148+
149+
/**
150+
* @internal
151+
*/
152+
public function __unset($name)
153+
{
154+
if ('renderer' === $name) {
155+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since version 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
156+
}
157+
158+
unset($this->$name);
159+
}
160+
97161
/**
98162
* {@inheritdoc}
99163
*/

src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public function getExtractData()
7272
}
7373

7474
/**
75-
* @expectedException \Twig_Error
76-
* @expectedExceptionMessageRegExp /Unclosed "block" in ".*extractor(\/|\\)syntax_error\.twig" at line 1/
75+
* @expectedException \Twig_Error
7776
* @dataProvider resourcesWithSyntaxErrorsProvider
7877
*/
7978
public function testExtractSyntaxError($resources)
@@ -82,7 +81,19 @@ public function testExtractSyntaxError($resources)
8281
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
8382

8483
$extractor = new TwigExtractor($twig);
85-
$extractor->extract($resources, new MessageCatalogue('en'));
84+
85+
try {
86+
$extractor->extract($resources, new MessageCatalogue('en'));
87+
} catch (\Twig_Error $e) {
88+
if (method_exists($e, 'getSourceContext')) {
89+
$this->assertSame(dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', DIRECTORY_SEPARATOR), $e->getFile());
90+
$this->assertSame(1, $e->getLine());
91+
$this->assertSame('Unclosed "block".', $e->getMessage());
92+
} else {
93+
$this->expectExceptionMessageRegExp('/Unclosed "block" in ".*extractor(\\/|\\\\)syntax_error\\.twig" at line 1/');
94+
}
95+
throw $e;
96+
}
8697
}
8798

8899
/**

src/Symfony/Bridge/Twig/Translation/TwigExtractor.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ public function extract($resource, MessageCatalogue $catalogue)
6161
try {
6262
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
6363
} catch (\Twig_Error $e) {
64-
if ($file instanceof SplFileInfo) {
65-
$e->setTemplateName($file->getRelativePathname());
66-
} elseif ($file instanceof \SplFileInfo) {
67-
$e->setTemplateName($file->getRealPath() ?: $file->getPathname());
64+
if ($file instanceof \SplFileInfo) {
65+
$path = $file->getRealPath() ?: $file->getPathname();
66+
$name = $file instanceof SplFileInfo ? $file->getRelativePathname() : $path;
67+
if (method_exists($e, 'setSourceContext')) {
68+
$e->setSourceContext(new \Twig_Source('', $name, $path));
69+
} else {
70+
$e->setTemplateName($name);
71+
}
6872
}
6973

7074
throw $e;

src/Symfony/Bundle/DebugBundle/Resources/config/services.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<service id="data_collector.dump" class="Symfony\Component\HttpKernel\DataCollector\DumpDataCollector">
1515
<tag name="data_collector" id="dump" template="@Debug/Profiler/dump.html.twig" priority="240" />
1616
<argument type="service" id="debug.stopwatch" on-invalid="ignore" />
17-
<argument type="service" id="debug.file_link_formatter"></argument>
17+
<argument type="service" id="debug.file_link_formatter" on-invalid="ignore"></argument>
1818
<argument>%kernel.charset%</argument>
1919
<argument type="service" id="request_stack" />
2020
<argument>null</argument><!-- var_dumper.cli_dumper when debug.dump_destination is set -->

0 commit comments

Comments
 (0)