8000 Merge branch '2.8' into 3.0 · symfony/symfony@89bb250 · GitHub
[go: up one dir, main page]

Skip to content

Commit 89bb250

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: 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 8a2d5cd + 15ab32b commit 89bb250

File tree

14 files changed

+65
-20
lines changed

14 files changed

+65
-20
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ matrix:
2424
group: edge
2525
- php: 5.5
2626
- php: 5.6
27-
env: deps=high
2827
- php: 7.0
28+
env: deps=high
29+
- php: 7.1
2930
env: deps=low
3031
fast_finish: true
3132

@@ -48,13 +49,12 @@ before_install:
4849
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
4950
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
5051
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
51-
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi
52-
- if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi
52+
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi
53+
- if [[ ! $skip && $PHP = 7.0 ]]; then (echo yes | pecl install -f apcu-5.1.5 && echo apc.enable_cli = 1 >> $INI_FILE); fi
5354
- 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
5455
- if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi
5556
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
56-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini; fi
57-
- if [[ ! $skip ]]; then composer self-update --stable; fi
57+
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
5858
- if [[ ! $skip ]]; then cp .composer/* ~/.composer/; fi
5959
- if [[ ! $skip ]]; then ./phpunit install; fi
6060
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi

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

Lines changed: 26 additions & 1 deletion
use Doctrine\DBAL\Driver\DriverException;
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\DBAL\Connection;
1515
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
448448
}
449449

450450
// create a two dimensional array (rowspan x colspan)
451-
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, ''), $unmergedRows);
451+
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
452452
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
453453
$value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
454454
$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/DependencyInjection/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": ">=5.5.9"
2020
},
2121
"require-dev": {
22-
"symfony/yaml": "~2.8|~3.0",
22+
"symfony/yaml": "~2.8.7|~3.0.9|~3.1.3|~3.2",
2323
"symfony/config": "~2.8|~3.0",
2424
"symfony/expression-language": "~2.8|~3.0"
2525
},

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

src/Symfony/Component/Validator/Constraints/File.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,22 @@ public function __get($option)
8888

8989
private function normalizeBinaryFormat($maxSize)
9090
{
91+
$sizeInt = (int) $maxSize;
92+
9193
if (ctype_digit((string) $maxSize)) {
92-
$this->maxSize = (int) $maxSize;
94+
$this->maxSize = $sizeInt;
9395
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
9496
} elseif (preg_match('/^\d++k$/i', $maxSize)) {
95-
$this->maxSize = $maxSize * 1000;
97+
$this->maxSize = $sizeInt * 1000;
9698
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
9799
} elseif (preg_match('/^\d++M$/i', $maxSize)) {
98-
$this->maxSize = $maxSize * 1000000;
100+
$this->maxSize = $sizeInt * 1000000;
99101
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
100102
} elseif (preg_match('/^\d++Ki$/i', $maxSize)) {
101-
$this->maxSize = $maxSize << 10;
103+
$this->maxSize = $sizeInt << 10;
102104
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
103105
} elseif (preg_match('/^\d++Mi$/i', $maxSize)) {
104-
$this->maxSize = $maxSize << 20;
106+
$this->maxSize = $sizeInt << 20;
105107
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
106108
} else {
107109
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize));

src/Symfony/Component/Validator/composer.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,20 @@
2121
"symfony/translation": "~2.8|~3.0"
2222
},
2323
"require-dev": {
24+
<<<<<<< HEAD
2425
"symfony/http-foundation": "~2.8|~3.0",
2526
"symfony/intl": "~2.8|~3.0",
2627
"symfony/yaml": "~2.8|~3.0",
2728
"symfony/config": "~2.8|~3.0",
2829
"symfony/expression-language": "~2.8|~3.0",
30+
=======
31+
"symfony/http-foundation": "~2.3|~3.0.0",
32+
"symfony/intl": "~2.7.4|~2.8|~3.0.0",
33+
"symfony/yaml": "~2.0,>=2.0.5|~3.0.0",
34+
"symfony/config": "~2.2|~3.0.0",
35+
"symfony/property-access": "~2.3|~3.0.0",
36+
"symfony/expression-language": "~2.4|~3.0.0",
37+
>>>>>>> 2.8
2938
"doctrine/annotations": "~1.0",
3039
"doctrine/cache": "~1.0",
3140
"egulias/email-validator": "~1.2,>=1.2.1"

src/Symfony/Component/VarDumper/Cloner/VarCloner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ private static function initHashMask()
315315
if (!empty($frame['line'])) {
316316
ob_start();
317317
debug_zval_dump($obj);
318-
self::$hashMask = substr(ob_get_clean(), 17);
318+
self::$hashMask = (int) substr(ob_get_clean(), 17);
319319
}
320320
}
321321

0 commit comments

Comments
 (0)
0