Skip to content

Commit a7ed68b

Browse files
Merge branch '2.8' into 3.0
* 2.8: (22 commits) Fix merge [HttpFoundation] Use UPSERT for sessions stored in PgSql >= 9.5 [Console] fixed PHPDoc [travis] HHVM 3.12 LTS Fix feature detection for IE [Form] Fixed collapsed choice attributes [Console] added explanation of messages usage in a progress bar force enabling the external XML entity loaders [Yaml] properly count skipped comment lines [WebProfilerBundle] Fix invalid CSS style Added progressive jpeg to mime types guesser [Yaml] Fix wrong line number when comments are inserted in the middle of a block. Fixed singular of committee Do not inject web debug toolbar on attachments bumped Symfony version to 2.8.8 updated VERSION for 2.8.7 updated CHANGELOG for 2.8.7 bumped Symfony version to 2.7.15 updated VERSION for 2.7.14 update CONTRIBUTORS for 2.7.14 ... Conflicts: CHANGELOG-2.7.md CHANGELOG-3.0.md src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php src/Symfony/Component/HttpKernel/Kernel.php
2 parents ceee603 + 625513d commit a7ed68b

File tree

31 files changed

+410
-72
lines changed

31 files changed

+410
-72
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
matrix:
1919
include:
2020
# Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version
21-
- php: hhvm
21+
- php: hhvm-3.12
2222
sudo: required
2323
dist: trusty
2424
group: edge

CHANGELOG-3.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c
362362
* bug #16312 [HttpKernel] clearstatcache() so the Cache sees when a .lck file has been released (mpdude)
363363
* bug #16351 [WIP] [Form] [TwigBridge] Bootstrap horizontal theme missing tests (pieter2627)
364364
* feature #16715 [Form] Remove choices_as_values option on ChoiceType (nicolas-grekas)
365-
* feature #16692 [Form] Drop remaing CsrfProviderAdapter/Interface mentions (nicolas-grekas)
365+
* feature #16692 [Form] Drop remaining CsrfProviderAdapter/Interface mentions (nicolas-grekas)
366366
* feature #16719 [Security] remove deprecated HTTP digest auth key (xabbuh)
367367
* bug #16685 [Form] Fixed: Duplicate choice labels are remembered when using "choices_as_values" = false (webmozart)
368368
* feature #16709 [Bridge\PhpUnit] Display the stack trace of a deprecation on-demand (nicolas-grekas)

CONTRIBUTORS.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Symfony is the result of the work of many people who made the code better
3939
- Maxime Steinhausser (ogizanagi)
4040
- Alexandre Salomé (alexandresalome)
4141
- William Durand (couac)
42-
- ornicar
4342
- Jules Pietri (heah)
43+
- ornicar
4444
- stealth35 ‏ (stealth35)
4545
- Alexander Mols (asm89)
4646
- Francis Besset (francisbesset)
@@ -65,9 +65,9 @@ Symfony is the result of the work of many people who made the code better
6565
- Dariusz Górecki (canni)
6666
- Arnout Boks (aboks)
6767
- Iltar van der Berg (kjarli)
68+
- Charles Sarrazin (csarrazi)
6869
- Ener-Getick (energetick)
6970
- Douglas Greenshields (shieldo)
70-
- Charles Sarrazin (csarrazi)
7171
- Lee McDermott
7272
- Brandon Turner
7373
- Luis Cordova (cordoval)
@@ -187,6 +187,7 @@ Symfony is the result of the work of many people who made the code better
187187
- Loïc Faugeron
188188
- Jannik Zschiesche (apfelbox)
189189
- Marco Pivetta (ocramius)
190+
- Teoh Han Hui (teohhanhui)
190191
- julien pauli (jpauli)
191192
- Michael Lee (zerustech)
192193
- Lorenz Schori
@@ -213,6 +214,7 @@ Symfony is the result of the work of many people who made the code better
213214
- Pierre-Yves LEBECQ (pylebecq)
214215
- Daniel Espendiller
215216
- Jakub Kucharovic (jkucharovic)
217+
- Robin Chalas (chalas_r)
216218
- Eugene Leonovich (rybakit)
217219
- Filippo Tessarotto
218220
- Joseph Rouff (rouffj)
@@ -275,7 +277,6 @@ Symfony is the result of the work of many people who made the code better
275277
- janschoenherr
276278
- Thomas Schulz (king2500)
277279
- Berny Cantos (xphere81)
278-
- Teoh Han Hui (teohhanhui)
279280
- Ricard Clau (ricardclau)
280281
- Mark Challoner (markchalloner)
281282
- Gregor Harlan (gharlan)
@@ -310,7 +311,6 @@ Symfony is the result of the work of many people who made the code better
310311
- Philipp Kräutli (pkraeutli)
311312
- Kirill chEbba Chebunin (chebba)
312313
- Greg Thornton (xdissent)
313-
- Robin Chalas (chalas_r)
314314
- Costin Bereveanu (schniper)
315315
- Loïc Chardonnet (gnusat)
316316
- Marek Kalnik (marekkalnik)
@@ -1414,6 +1414,7 @@ Symfony is the result of the work of many people who made the code better
14141414
- Damon Jones (damon__jones)
14151415
- David Badura (davidbadura)
14161416
- Daniel Londero (dlondero)
1417+
- Sebastian Landwehr (dword123)
14171418
- Adel ELHAIBA (eadel)
14181419
- Damián Nohales (eagleoneraptor)
14191420
- Elliot Anderson (elliot)

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function write($sessionId, $data)
180180
$updateStmt->bindValue(':time', time(), \PDO::PARAM_INT);
181181
$updateStmt->execute();
182182

183-
// When MERGE is not supported, like in Postgres, we have to use this approach that can result in
183+
// When MERGE is not supported, like in Postgres < 9.5, we have to use this approach that can result in
184184
// duplicate key errors when the same session is written simultaneously. We can just catch such an
185185
// error and re-execute the update. This is similar to a serializable transaction with retry logic
186186
// on serialization failures but without the overhead and without possible false positives due to
@@ -224,11 +224,11 @@ private function getMergeSql()
224224
{
225225
$platform = $this->con->getDatabasePlatform()->getName();
226226

227-
switch ($platform) {
228-
case 'mysql':
227+
switch (true) {
228+
case 'mysql' === $platform:
229229
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
230230
"ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->timeCol = VALUES($this->timeCol)";
231-
case 'oracle':
231+
case 'oracle' === $platform:
232232
// DUAL is Oracle specific dummy table
233233
return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ".
234234
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
@@ -239,8 +239,11 @@ private function getMergeSql()
239239
return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ".
240240
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
241241
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;";
242-
case 'sqlite':
242+
case 'sqlite' === $platform:
243243
return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)";
244+
case 'postgresql' === $platform && version_compare($this->con->getServerVersion(), '9.5', '>='):
245+
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
246+
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (:data, :time) WHERE $this->idCol = :id";
244247
}
245248
}
246249
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>"
2+
<?php if ($disabled): ?>disabled="disabled" <?php endif ?>
3+
<?php foreach ($choice_attr as $k => $v): ?>
4+
<?php if ($v === true): ?>
5+
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?>
6+
<?php elseif ($v !== false): ?>
7+
<?php printf('%s="%s" ', $view->escape($k), $view->escape($v)) ?>
8+
<?php endif ?>
9+
<?php endforeach ?>

src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<?php echo $formHelper->block($form, 'choice_widget_options', array('choices' => $choice)) ?>
99
</optgroup>
1010
<?php else: ?>
11-
<option value="<?php echo $view->escape($choice->value) ?>" <?php echo $view['form']->block($form, 'attributes', array('attr' => $choice->attr)) ?><?php if ($is_selected($choice->value, $value)): ?> selected="selected"<?php endif?>><?php echo $view->escape(false !== $choice_translation_domain ? $translatorHelper->trans($choice->label, array(), $choice_translation_domain) : $choice->label) ?></option>
11+
<option value="<?php echo $view->escape($choice->value) ?>" <?php echo $formHelper->block($form, 'choice_attributes', array('choice_attr' => $choice->attr)) ?><?php if ($is_selected($choice->value, $value)): ?> selected="selected"<?php endif?>><?php echo $view->escape(false !== $choice_translation_domain ? $translatorHelper->trans($choice->label, array(), $choice_translation_domain) : $choice->label) ?></option>
1212
<?php endif ?>
1313
<?php endforeach ?>

src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function onKernelResponse(FilterResponseEvent $event)
9898
|| $response->isRedirection()
9999
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
100100
|| 'html' !== $request->getRequestFormat()
101+
|| false !== stripos($response->headers->get('Content-Disposition'), 'attachment;')
101102
) {
102103
return;
103104
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
var addEventListener;
212212
213213
var el = document.createElement('div');
214-
if (!'addEventListener' in el) {
214+
if (!('addEventListener' in el)) {
215215
addEventListener = function (element, eventName, callback) {
216216
element.attachEvent('on' + eventName, callback);
217217
};

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<h3>Route Redirection</h3>
3131

3232
<p>This page redirects to:</p>
33-
<div class="card" style="break-long-words">
33+
<div class="card break-long-words">
3434
{{ router.targetUrl }}
3535
{% if router.targetRoute %}<span class="text-muted">(route: "{{ router.targetRoute }}")</span>{% endif %}
3636
</div>

src/Symfony/Bundle/WebProfilerBundle/Tests/EventListener/WebDebugToolbarListenerTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,21 @@ public function testToolbarIsInjected()
8282
$this->assertEquals("<html><head></head><body>\nWDT\n</body></html>", $response->getContent());
8383
}
8484

85+
/**
86+
* @depends testToolbarIsInjected
87+
*/
88+
public function testToolbarIsNotInjectedOnContentDispositionAttachment()
89+
{
90+
$response = new Response('<html><head></head><body></body></html>');
91+
$response->headers->set('Content-Disposition', 'attachment; filename=test.html');
92+
$event = new FilterResponseEvent($this->getKernelMock(), $this->getRequestMock(false, 'html'), HttpKernelInterface::MASTER_REQUEST, $response);
93+
94+
$listener = new WebDebugToolbarListener($this->getTwigMock());
95+
$listener->onKernelResponse($event);
96+
97+
$this->assertEquals('<html><head></head><body></body></html>', $response->getContent());
98+
}
99+
85100
/**
86101
* @depends testToolbarIsInjected
87102
* @dataProvider provideRedirects

0 commit comments

Comments
 (0)