Skip to content

Commit a5a03aa

Browse files
committed
Merge branch '3.1'
* 3.1: fixed bad merge Fix PHP 7.1 related failures [VarDumper] Fix for 7.1 fixed CS Added class existence check if is_subclass_of() fails in compiler passes Fix the DBAL session handler version check for Postgresql
2 parents 583a45d + 00f1b7b commit a5a03aa

File tree

12 files changed

+55
-18
lines changed

12 files changed

+55
-18
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ matrix:
2626
group: edge
2727
- php: 5.5
2828
- php: 5.6
29-
env: deps=high
3029
- php: 7.0
30+
env: deps=high
31+
- php: 7.1
3132
env: deps=low
3233
fast_finish: true
3334

@@ -55,13 +56,13 @@ before_install:
5556
- if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi
5657
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
5758
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
58-
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi
59-
- if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi
59+
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi
60+
- if [[ ! $skip && $PHP = 7.0 ]]; then (echo yes | pecl install -f apcu-5.1.5 && echo apc.enable_cli = 1 >> $INI_FILE); fi
6061
- if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi
6162
- if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi
6263
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
6364
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = redis.so >> $INI_FILE; fi;
64-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini; fi
65+
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
6566
- if [[ ! $skip ]]; then composer self-update --stable; fi
6667
- if [[ ! $skip ]]; then cp .composer/* ~/.composer/; fi
6768
- if [[ ! $skip ]]; then ./phpunit install; fi

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\DBAL\Connection;
1515
use Doctrine\DBAL\Driver\DriverException;
16+
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
1617
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
1718

1819
/**
@@ -241,9 +242,33 @@ private function getMergeSql()
241242
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->timeCol = :time;";
242243
case 'sqlite' === $platform:
243244
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+
case 'postgresql' === $platform && version_compare($this->getServerVersion(), '9.5', '>='):
245246
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
246247
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->timeCol)";
247248
}
248249
}
250+
251+
private function getServerVersion()
252+
{
253+
$params = $this->con->getParams();
254+
255+
// Explicit platform version requested (supersedes auto-detection), so we respect it.
256+
if (isset($params['serverVersion'])) {
257+
return $params['serverVersion'];
258+
}
259+
260+
$wrappedConnection = $this->con->getWrappedConnection();
261+
262+
if ($wrappedConnection instanceof ServerInfoAwareConnection) {
263+
return $wrappedConnection->getServerVersion();
264+
}
265+
266+
// Support DBAL 2.4 by accessing it directly when using PDO PgSQL
267+
if ($wrappedConnection instanceof \PDO) {
268+
return $wrappedConnection->getAttribute(\PDO::ATTR_SERVER_VERSION);
269+
}
270+
271+
// If we cannot guess the version, the empty string will mean we won't use the code for newer versions when doing version checks.
272+
return '';
273+
}
249274
}

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ class ProjectServiceContainer extends Container
2222
}
2323
}
2424

25-
class stdClass_%s extends \stdClass implements \ProxyManager\%s
25+
class stdClass_%s extends %SstdClass implements \ProxyManager\%s
2626
{%a}%A

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"symfony/security-acl": "~2.8|~3.0",
3434
"symfony/stopwatch": "~2.8|~3.0",
3535
"symfony/console": "~2.8|~3.0",
36-
"symfony/var-dumper": "~2.8|~3.0",
36+
"symfony/var-dumper": "~2.8.9|~3.0.9|~3.1.3|~3.2",
3737
"symfony/expression-language": "~2.8|~3.0"
3838
},
3939
"suggest": {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ private function fillNextRows($rows, $line)
487487
}
488488

489489
// create a two dimensional array (rowspan x colspan)
490-
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, ''), $unmergedRows);
490+
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
491491
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
492492
$value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
493493
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));

src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testCrossCheck($fixture, $type)
3434
$loaderClass = 'Symfony\\Component\\DependencyInjection\\Loader\\'.ucfirst($type).'FileLoader';
3535
$dumperClass = 'Symfony\\Component\\DependencyInjection\\Dumper\\'.ucfirst($type).'Dumper';
3636

37-
$tmp = tempnam('sf_service_container', 'sf');
37+
$tmp = tempnam(sys_get_temp_dir(), 'sf');
3838

3939
file_put_contents($tmp, file_get_contents(self::$fixturesPath.'/'.$type.'/'.$fixture));
4040

src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@ public function process(ContainerBuilder $container)
9797

9898
// We must assume that the class value has been correctly filled, even if the service is created by a factory
9999
$class = $container->getParameterBag()->resolveValue($def->getClass());
100-
101100
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
101+
102102
if (!is_subclass_of($class, $interface)) {
103+
if (!class_exists($class, false)) {
104+
throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
105+
}
106+
103107
throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
104108
}
105109

src/Symfony/Component/Form/Util/OrderedHashMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function offsetSet($key, $value)
130130
? 0
131131
// Imitate PHP's behavior of generating a key that equals
132132
// the highest existing integer key + 1
133-
: max($this->orderedKeys) + 1;
133+
: 1 + (int) max($this->orderedKeys);
134134
}
135135

136136
$this->orderedKeys[] = $key;

src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ abstract class CacheWarmer implements CacheWarmerInterface
2020
{
2121
protected function writeCacheFile($file, $content)
2222
{
23-
$tmpFile = tempnam(dirname($file), basename($file));
23+
$tmpFile = @tempnam(dirname($file), basename($file));
2424
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
2525
@chmod($file, 0666 & ~umask());
2626

src/Symfony/Component/HttpKernel/DependencyInjection/FragmentRendererPass.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ public function process(ContainerBuilder $container)
5353

5454
$class = $container->getParameterBag()->resolveValue($def->getClass());
5555
$interface = 'Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface';
56+
5657
if (!is_subclass_of($class, $interface)) {
58+
if (!class_exists($class, false)) {
59+
throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
60+
}
61+
5762
throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
5863
}
5964

0 commit comments

Comments
 (0)