Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2291484

Browse files
Merge branch '3.4'
* 3.4: (23 commits) Don't display the Symfony debug toolbar when printing the page [Routing] also add matched params for redirect due to trailing slash do not wire namespaces for the ArrayAdapter check _controller attribute is a string before parsing it [Cache] Added test for ApcuAdapter when using in CLI [Validator] sync upgrade file with latest code changes allow to configure custom formats in XML configs [HttpKernel] fix DumpDataCollector tests [FrameworkBundle] fix changelog [WebProfilerBundle] Cleanup profiler leftover [Routing] Add matched and default parameters to redirect responses [DotEnv] Fix variable substitution require the XML PHP extension Fix phpdoc for serializer normalizers exceptions Fixed absolute url generation for query strings and hash urls bumped Symfony version to 2.8.25 updated VERSION for 2.8.24 updated CHANGELOG for 2.8.24 bumped Symfony version to 2.7.32 [Filesystem] Dont copy perms when origin is remote ...
2 parents d203ee3 + 77b8ea7 commit 2291484

File tree

39 files changed

+337
-151
lines changed

39 files changed

+337
-151
lines changed

CONTRIBUTORS.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ Symfony is the result of the work of many people who made the code better
7070
- Deni
7171
- Henrik Westphal (snc)
7272
- Dariusz Górecki (canni)
73+
- Jáchym Toušek (enumag)
7374
- Titouan Galopin (tgalopin)
7475
- Douglas Greenshields (shieldo)
75-
- Jáchym Toušek (enumag)
7676
- Konstantin Myakshin (koc)
7777
- Lee McDermott
7878
- Brandon Turner
@@ -99,19 +99,19 @@ Symfony is the result of the work of many people who made the code better
9999
- Baptiste Clavié (talus)
100100
- Vladimir Reznichenko (kalessil)
101101
- marc.weistroff
102+
- Yonel Ceruto González (yonelceruto)
102103
- lenar
103104
- Włodzimierz Gajda (gajdaw)
104-
- Yonel Ceruto González (yonelceruto)
105105
- Alexander Schwenn (xelaris)
106106
- Jacob Dreesen (jdreesen)
107+
- Tobias Nyholm (tobias)
107108
- Florian Voutzinos (florianv)
108109
- Colin Frei
109110
- Adrien Brault (adrienbrault)
110111
- Joshua Thijssen
111112
- Peter Kokot (maastermedia)
112113
- David Buchmann (dbu)
113114
- excelwebzone
114-
- Tobias Nyholm (tobias)
115115
- Tomáš Votruba (tomas_votruba)
116116
- Fabien Pennequin (fabienpennequin)
117117
- Gordon Franke (gimler)
@@ -133,12 +133,15 @@ Symfony is the result of the work of many people who made the code better
133133
- Guilherme Blanco (guilhermeblanco)
134134
- Pablo Godel (pgodel)
135135
- Jérémie Augustin (jaugustin)
136+
- Dany Maillard (maidmaid)
136137
- Andréia Bohner (andreia)
137138
- Rafael Dohms (rdohms)
138139
- Arnaud Kleinpeter (nanocom)
139140
- jwdeitch
141+
- David Maicher (dmaicher)
140142
- Mikael Pajunen
141143
- Joel Wurtz (brouznouf)
144+
- Grégoire Paris (greg0ire)
142145
- Philipp Wahala (hifi)
143146
- Vyacheslav Pavlov
144147
- Richard van Laak (rvanlaak)
@@ -147,11 +150,9 @@ Symfony is the result of the work of many people who made the code better
147150
- Thomas Rabaix (rande)
148151
- Rouven Weßling (realityking)
149152
- Teoh Han Hui (teohhanhui)
150-
- David Maicher (dmaicher)
151153
- Jérôme Vasseur (jvasseur)
152154
- Clemens Tolboom
153155
- Helmer Aaviksoo
154-
- Grégoire Paris (greg0ire)
155156
- Hiromi Hishida (77web)
156157
- Matthieu Ouellette-Vachon (maoueh)
157158
- Michał Pipa (michal.pipa)
@@ -236,7 +237,6 @@ Symfony is the result of the work of many people who made the code better
236237
- Arjen Brouwer (arjenjb)
237238
- Katsuhiro OGAWA
238239
- Patrick McDougle (patrick-mcdougle)
239-
- Dany Maillard (maidmaid)
240240
- Alif Rachmawadi
241241
- Kristen Gilden (kgilden)
242242
- Pierre-Yves LEBECQ (pylebecq)
@@ -622,6 +622,7 @@ Symfony is the result of the work of many people who made the code better
622622
- develop
623623
- ReenExe
624624
- Mark Sonnabaum
625+
- Maxime Veber (nek-)
625626
- Richard Quadling
626627
- jochenvdv
627628
- Arturas Smorgun (asarturas)
@@ -644,6 +645,7 @@ Symfony is the result of the work of many people who made the code better
644645
- Trent Steel (trsteel88)
645646
- Yuen-Chi Lian
646647
- Besnik Br
648+
- Jose Gonzalez
647649
- Dariusz Ruminski
648650
- Joshua Nye
649651
- Claudio Zizza
@@ -1083,7 +1085,6 @@ Symfony is the result of the work of many people who made the code better
10831085
- Max Summe
10841086
- WedgeSama
10851087
- Felds Liscia
1086-
- Maxime Veber (nek-)
10871088
- Sullivan SENECHAL
10881089
- Tadcka
10891090
- Beth Binkovitz
@@ -1094,12 +1095,12 @@ Symfony is the result of the work of many people who made the code better
10941095
- Tomaz Ahlin
10951096
- Marcus Stöhr (dafish)
10961097
- Emmanuel Vella (emmanuel.vella)
1098+
- Adam Szaraniec (mimol)
10971099
- Carsten Nielsen (phreaknerd)
10981100
- Mathieu Rochette
10991101
- Jay Severson
11001102
- René Kerner
11011103
- Nathaniel Catchpole
1102-
- Jose Gonzalez
11031104
- Adrien Samson (adriensamson)
11041105
- Samuel Gordalina (gordalina)
11051106
- Max Romanovsky (maxromanovsky)
@@ -1260,6 +1261,7 @@ Symfony is the result of the work of many people who made the code better
12601261
- Aarón Nieves Fernández
12611262
- Mike Meier
12621263
- Kirill Saksin
1264+
- Julien Pauli
12631265
- Koalabaerchen
12641266
- michalmarcinkowski
12651267
- Warwick
@@ -1307,6 +1309,7 @@ Symfony is the result of the work of many people who made the code better
13071309
- klemens
13081310
- dened
13091311
- Dmitry Korotovsky
1312+
- mcorteel
13101313
- Michael van Tricht
13111314
- Sam Ward
13121315
- Walther Lalk
@@ -1337,6 +1340,7 @@ Symfony is the result of the work of many people who made the code better
13371340
- Jan Marek (janmarek)
13381341
- Mark de Haan (markdehaan)
13391342
- Dan Patrick (mdpatrick)
1343+
- Pedro Magalhães (pmmaga)
13401344
- Rares Vlaseanu (raresvla)
13411345
- tante kinast (tante)
13421346
- Vincent LEFORT (vlefort)
@@ -1544,6 +1548,7 @@ Symfony is the result of the work of many people who made the code better
15441548
- Abdulkadir N. A.
15451549
- Yevgen Kovalienia
15461550
- Lebnik
1551+
- Shude
15471552
- Ondřej Führer
15481553
- Sema
15491554
- Elan Ruusamäe

UPGRADE-4.0.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,6 @@ Validator
587587
}
588588
```
589589

590-
* The default value of the strict option of the `Choice` Constraint has been
591-
changed to `true` as of 4.0. If you need the previous behaviour ensure to
592-
set the option to `false`.
593-
594590
* Setting the `checkDNS` option of the `Url` constraint to `true` is dropped
595591
in favor of `Url::CHECK_DNS_TYPE_*` constants values.
596592

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": "^7.1.3",
20+
"ext-xml": "*",
2021
"doctrine/common": "~2.4",
2122
"fig/link-util": "^1.0",
2223
"twig/twig": "~1.34|~2.4",

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ public function generateAbsoluteUrl($path)
7272
$port = ':'.$this->requestContext->getHttpsPort();
7373
}
7474

75+
if ('#' === $path[0]) {
76+
$queryString = $this->requestContext->getQueryString();
77+
$path = $this->requestContext->getPathInfo().($queryString ? '?'.$queryString : '').$path;
78+
} elseif ('?' === $path[0]) {
79+
$path = $this->requestContext->getPathInfo().$path;
80+
}
81+
7582
if ('/' !== $path[0]) {
7683
$path = rtrim($this->requestContext->getBaseUrl(), '/').'/'.$path;
7784
}
@@ -82,6 +89,12 @@ public function generateAbsoluteUrl($path)
8289
return $path;
8390
}
8491

92+
if ('#' === $path[0]) {
93+
$path = $request->getRequestUri().$path;
94+
} elseif ('?' === $path[0]) {
95+
$path = $request->getPathInfo().$path;
96+
}
97+
8598
if (!$path || '/' !== $path[0]) {
8699
$prefix = $request->getPathInfo();
87100
$last = strlen($prefix) - 1;

src/Symfony/Bridge/Twig/Tests/Extension/HttpFoundationExtensionTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ public function getGenerateAbsoluteUrlData()
4242
array('http://example.com/baz', 'http://example.com/baz', '/'),
4343
array('https://example.com/baz', 'https://example.com/baz', '/'),
4444
array('//example.com/baz', '//example.com/baz', '/'),
45+
46+
array('http://localhost/foo/bar?baz', '?baz', '/foo/bar'),
47+
array('http://localhost/foo/bar?baz=1', '?baz=1', '/foo/bar?foo=1'),
48+
array('http://localhost/foo/baz?baz=1', 'baz?baz=1', '/foo/bar?foo=1'),
49+
50+
array('http://localhost/foo/bar#baz', '#baz', '/foo/bar'),
51+
array('http://localhost/foo/bar?0#baz', '#baz', '/foo/bar?0'),
52+
array('http://localhost/foo/bar?baz=1#baz', '?baz=1#baz', '/foo/bar?foo=1'),
53+
array('http://localhost/foo/baz?baz=1#baz', 'baz?baz=1#baz', '/foo/bar?foo=1'),
4554
);
4655
}
4756

src/Symfony/Bundle/DebugBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": "^7.1.3",
20+
"ext-xml": "*",
2021
"symfony/http-kernel": "~3.4|~4.0",
2122
"symfony/twig-bridge": "~3.4|~4.0",
2223
"symfony/var-dumper": "~3.4|~4.0"

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ CHANGELOG
108108
* Deprecated using core form types without dependencies as services
109109
* Added `Symfony\Component\HttpHernel\DataCollector\RequestDataCollector::onKernelResponse()`
110110
* Added `Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector`
111-
* Deprecated service `serializer.mapping.cache.apc` (use `serializer.mapping.cache.doctrine.apc` instead)
111+
* The `framework.serializer.cache` option and the service `serializer.mapping.cache.apc` have been
112+
deprecated. APCu should now be automatically used when available.
112113

113114
3.0.0
114115
-----

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
1313

1414
use Symfony\Component\Cache\Adapter\AbstractAdapter;
15+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1516
use Symfony\Component\DependencyInjection\ChildDefinition;
1617
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1718
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -72,7 +73,7 @@ public function process(ContainerBuilder $container)
7273
}
7374
$i = 0;
7475
foreach ($attributes as $attr) {
75-
if (isset($tags[0][$attr])) {
76+
if (isset($tags[0][$attr]) && ('namespace' !== $attr || ArrayAdapter::class !== $adapter->getClass())) {
7677
$pool->replaceArgument($i++, $tags[0][$attr]);
7778
}
7879
unset($tags[0][$attr]);

src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(ControllerNameParser $parser)
3333
public function onKernelRequest(GetResponseEvent $event)
3434
{
3535
$controller = $event->getRequest()->attributes->get('_controller');
36-
if ($controller && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
36+
if (is_string($controller) && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
3737
// controller in the a:b:c notation then
3838
$event->getRequest()->attributes->set('_controller', $this->parser->parse($controller));
3939
}

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php

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

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPass;
16+
use Symfony\Component\Cache\Adapter\ArrayAdapter;
1617
use Symfony\Component\DependencyInjection\ChildDefinition;
1718
use Symfony\Component\DependencyInjection\ContainerBuilder;
1819
use Symfony\Component\DependencyInjection\Definition;
@@ -49,6 +50,24 @@ public function testNamespaceArgumentIsReplaced()
4950
$this->assertSame('D07rhFx97S', $cachePool->getArgument(0));
5051
}
5152

53+
public function testNamespaceArgumentIsNotReplacedIfArrayAdapterIsUsed()
54+
{
55+
$container = new ContainerBuilder();
56+
$container->setParameter('kernel.environment', 'prod');
57+
$container->setParameter('kernel.name', 'app');
58+
$container->setParameter('kernel.root_dir', 'foo');
59+
60+
$container->register('cache.adapter.array', ArrayAdapter::class)->addArgument(0);
61+
62+
$cachePool = new ChildDefinition('cache.adapter.array');
63+
$cachePool->addTag('cache.pool');
64+
$container->setDefinition('app.cache_pool', $cachePool);
65+
66+
$this->cachePoolPass->process($container);
67+
68+
$this->assertCount(0, $container->getDefinition('app.cache_pool')->getArguments());
69+
}
70+
5271
public function testArgsAreReplaced()
5372
{
5473
$container = new ContainerBuilder();

src/Symfony/Bundle/FrameworkBundle/Tests/EventListener/ResolveControllerNameSubscriberTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,27 @@ public function testReplacesControllerAttribute()
3737
$this->assertEquals('App\\Final\\Format::methodName', $request->attributes->get('_controller'));
3838
}
3939

40-
public function testSkipsOtherControllerFormats()
40+
/**
41+
* @dataProvider provideSkippedControllers
42+
*/
43+
public function testSkipsOtherControllerFormats($controller)
4144
{
4245
$parser = $this->getMockBuilder(ControllerNameParser::class)->disableOriginalConstructor()->getMock();
4346
$parser->expects($this->never())
4447
->method('parse');
4548
$httpKernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock();
4649

4750
$request = new Request();
48-
$request->attributes->set('_controller', 'Other:format');
51+
$request->attributes->set('_controller', $controller);
4952

5053
$subscriber = new ResolveControllerNameSubscriber($parser);
5154
$subscriber->onKernelRequest(new GetResponseEvent($httpKernel, $request, HttpKernelInterface::MASTER_REQUEST));
52-
$this->assertEquals('Other:format', $request->attributes->get('_controller'));
55+
$this->assertEquals($controller, $request->attributes->get('_controller'));
56+
}
57+
58+
public function provideSkippedControllers()
59+
{
60+
yield array('Other:format');
61+
yield array(function () {});
5362
}
5463
}

src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RedirectableUrlMatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testRedirectWhenNoSlash()
3333
'scheme' => null,
3434
'httpPort' => $context->getHttpPort(),
3535
'httpsPort' => $context->getHttpsPort(),
36-
'_route' => null,
36+
'_route' => 'foo',
3737
),
3838
$matcher->match('/foo')
3939
);

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": "^7.1.3",
20+
"ext-xml": "*",
2021
"symfony/security": "~3.4|~4.0",
2122
"symfony/dependency-injection": "~3.4|~4.0",
2223
"symfony/http-kernel": "~3.4|~4.0"

src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
<xsd:complexType name="config">
1111
<xsd:sequence>
12+
<xsd:element name="date" type="date" minOccurs="0" maxOccurs="1" />
13+
<xsd:element name="number-format" type="number_format" minOccurs="0" maxOccurs="1" />
1214
<xsd:element name="form-theme" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
1315
<xsd:element name="global" type="global" minOccurs="0" maxOccurs="unbounded" />
1416
<xsd:element name="path" type="path" minOccurs="0" maxOccurs="unbounded" />
@@ -26,6 +28,18 @@
2628
<xsd:attribute name="exception-controller" type="xsd:string" />
2729
</xsd:complexType>
2830

31+
<xsd:complexType name="date">
32+
<xsd:attribute name="format" type="xsd:string" />
33+
<xsd:attribute name="interval-format" type="xsd:string" />
34+
<xsd:attribute name="timezone" type="xsd:string" />
35+
</xsd:complexType>
36+
37+
<xsd:complexType name="number_format">
38+
<xsd:attribute name="decimals" type="xsd:integer" />
39+
<xsd:attribute name="decimal-point" type="xsd:string" />
40+
<xsd:attribute name="thousands-separator" type="xsd:string" />
41+
</xsd:complexType>
42+
2943
<xsd:complexType name="path" mixed="true">
3044
<xsd:attribute name="namespace" type="xsd:string" />
3145
</xsd:complexType>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$container->loadFromExtension('twig', array(
4+
'date' => array(
5+
'format' => 'Y-m-d',
6+
'interval_format' => '%d',
7+
'timezone' => 'Europe/Berlin',
8+
),
9+
'number_format' => array(
10+
'decimals' => 2,
11+
'decimal_point' => ',',
12+
'thousands_separator' => '.',
13+
),
14+
));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:twig="http://symfony.com/schema/dic/twig"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
7+
8+
<twig:config>
9+
<twig:date format="Y-m-d" interval-format="%d" timezone="Europe/Berlin" />
10+
<twig:number-format decimals="2" decimal-point="," thousands-separator="." />
11+
</twig:config>
12+
</container>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
twig:
2+
date:
3+
format: Y-m-d
4+
interval_format: '%d'
5+
timezone: Europe/Berlin
6+
number_format:
7+
decimals: 2
8+
decimal_point: ','
9+
thousands_separator: .

0 commit comments

Comments
 (0)