8000 Merge branch '2.8' into 3.2 · symfony/symfony@6435c7f · GitHub
[go: up one dir, main page]

Skip to content

Commit 6435c7f

Browse files
Merge branch '2.8' into 3.2
* 2.8: Don't display the Symfony debug toolbar when printing the page allow to configure custom formats in XML configs require the XML PHP extension 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 updated VERSION for 2.7.31 update CONTRIBUTORS for 2.7.31 updated CHANGELOG for 2.7.31
2 parents 0e988ca + 6735b35 commit 6435c7f

File tree

13 files changed

+122
-13
lines changed

13 files changed

+122
-13
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

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": ">=5.5.9",
20+
"ext-xml": "*",
2021
"doctrine/common": "~2.4",
2122
"twig/twig": "~1.34|~2.4",
2223
"psr/cache": "~1.0",

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": ">=5.5.9",
20+
"ext-xml": "*",
2021
"symfony/http-kernel": "~2.8|~3.0",
2122
"symfony/twig-bridge": "~2.8|~3.0",
2223
"symfony/var-dumper": "~2.8|~3.0"

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": ">=5.5.9",
20+
"ext-xml": "*",
2021
"symfony/security": "~3.2",
2122
"symfony/http-kernel": "~3.2",
2223
"symfony/polyfill-php70": "~1.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: .

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ public function testLoadDefaultTemplateEscapingGuesserConfiguration($format)
116116
$this->assertEquals('name', $options['autoescape']);
117117
}
118118

119+
/**
120+
* @dataProvider getFormats
121+
*/
122+
public function testLoadCustomDateFormats($fileFormat)
123+
{
124+
$container = $this->createContainer();
125+
$container->registerExtension(new TwigExtension());
126+
$this->loadFromFile($container, 'formats', $fileFormat);
127+
$this->compileContainer($container);
128+
129+
$environmentConfigurator = $container->getDefinition('twig.configurator.environment');
130+
131+
$this->assertSame('Y-m-d', $environmentConfigurator->getArgument(0));
132+
$this->assertSame('%d', $environmentConfigurator->getArgument(1));
133+
$this->assertSame('Europe/Berlin', $environmentConfigurator->getArgument(2));
134+
$this->assertSame(2, $environmentConfigurator->getArgument(3));
135+
$this->assertSame(',', $environmentConfigurator->getArgument(4));
136+
$this->assertSame('.', $environmentConfigurator->getArgument(5));
137+
}
138+
119139
public function testGlobalsWithDifferentTypesAndValues()
120140
{
121141
$globals = array(

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,10 @@
552552
padding: 5px 0;
553553
margin-right: 10px;
554554
}
555+
556+
/***** Media query print: Do not print the Toolbar. *****/
557+
@media print {
558+
.sf-toolbar {
559+
display: none;
560+
}
561+
}

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class Filesystem
3737
*/
3838
public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
3939
{
40-
if (stream_is_local($originFile) && !is_file($originFile)) {
40+
$originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
41+
if ($originIsLocal && !is_file($originFile)) {
4142
throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
4243
}
4344

@@ -68,11 +69,13 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
6869
throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
6970
}
7071

71-
// Like `cp`, preserve executable permission bits
72-
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
72+
if ($originIsLocal) {
73+
// Like `cp`, preserve executable permission bits
74+
@chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
7375

74-
if (stream_is_local($originFile) && $bytesCopied !== ($bytesOrigin = filesize($originFile))) {
75-
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
76+
if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
77+
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
78+
}
7679
}
7780
}
7881
}

0 commit comments

Comments
 (0)
0