Skip to content

Commit 7fa2eab

Browse files
Merge branch '2.7' into 2.8
* 2.7: [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 Conflicts: src/Symfony/Component/Translation/Loader/XliffFileLoader.php
2 parents 5e8f7c2 + 347cd87 commit 7fa2eab

File tree

18 files changed

+276
-77
lines changed

18 files changed

+276
-77
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

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/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/Component/Console/Helper/ProgressBar.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ProgressBar
4242
private $stepWidth;
4343
private $percent = 0.0;
4444
private $formatLineCount;
45-
private $messages;
45+
private $messages = array();
4646
private $overwrite = true;
4747

4848
private static $formatters;
@@ -140,6 +140,16 @@ public static function getFormatDefinition($name)
140140
return isset(self::$formats[$name]) ? self::$formats[$name] : null;
141141
}
142142

143+
/**
144+
* Associates a text with a named placeholder.
145+
*
146+
* The text is displayed when the progress bar is rendered but only
147+
* when the corresponding placeholder is part of the custom format line
148+
* (by wrapping the name with %).
149+
*
150+
* @param string $message The text to associate with the placeholder
151+
* @param string $name The name of the placeholder
152+
*/
143153
public function setMessage($message, $name = 'message')
144154
{
145155
$this->messages[$name] = $message;

src/Symfony/Component/Console/Helper/TableSeparator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
class TableSeparator extends TableCell
2020
{
2121
/**
22-
* @param string $value
23-
* @param array $options
22+
* @param array $options
2423
*/
2524
public function __construct(array $options = array())
2625
{

src/Symfony/Component/Console/Output/NullOutput.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,33 @@ public function getVerbosity()
7373
return self::VERBOSITY_QUIET;
7474
}
7575

76+
/**
77+
* {@inheritdoc}
78+
*/
7679
public function isQuiet()
7780
{
7881
return true;
7982
}
8083

84+
/**
85+
* {@inheritdoc}
86+
*/
8187
public function isVerbose()
8288
{
8389
return false;
8490
}
8591

92+
/**
93+
* {@inheritdoc}
94+
*/
8695
public function isVeryVerbose()
8796
{
8897
return false;
8998
}
9099

100+
/**
101+
* {@inheritdoc}
102+
*/
91103
public function isDebug()
92104
{
93105
return false;

src/Symfony/Component/Console/Output/Output.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,33 @@ public function getVerbosity()
9494
return $this->verbosity;
9595
}
9696

97+
/**
98+
* {@inheritdoc}
99+
*/
97100
public function isQuiet()
98101
{
99102
return self::VERBOSITY_QUIET === $this->verbosity;
100103
}
101104

105+
/**
106+
* {@inheritdoc}
107+
*/
102108
public function isVerbose()
103109
{
104110
return self::VERBOSITY_VERBOSE <= $this->verbosity;
105111
}
106112

113+
/**
114+
* {@inheritdoc}
115+
*/
107116
public function isVeryVerbose()
108117
{
109118
return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
110119
}
111120

121+
/**
122+
* {@inheritdoc}
123+
*/
112124
public function isDebug()
113125
{
114126
return self::VERBOSITY_DEBUG <= $this->verbosity;

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ private function processAnonymousServices(\DOMDocument $xml, $file)
338338
foreach ($definitions as $id => $def) {
339339
list($domElement, $file, $wild) = $def;
340340

341-
342341
if (null !== $definition = $this->parseDefinition($domElement, $file)) {
343342
$this->container->setDefinition($id, $definition);
344343
}
@@ -508,7 +507,9 @@ public function validateSchema(\DOMDocument $dom)
508507
EOF
509508
;
510509

510+
$disableEntities = libxml_disable_entity_loader(false);
511511
$valid = @$dom->schemaValidateSource($source);
512+
libxml_disable_entity_loader($disableEntities);
512513

513514
foreach ($tmpfiles as $tmpfile) {
514515
@unlink($tmpfile);

0 commit comments

Comments
 (0)