1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
From: Nicolas Grekas <nicolas.grekas@gmail.com>
Date: Tue, 19 Jul 2016 08:52:31 +0200
Subject: Fix PHP 7.1 related failures
Origin: backport, https://github.com/symfony/symfony/commit/07467ed3a3aca5bd8760060e4472cf519b7812c5
Bug-Debian: https://bugs.debian.org/832858
---
.travis.yml | 10 +++++-----
.../Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt | 4 ++--
src/Symfony/Component/Console/Helper/Table.php | 2 +-
.../Component/DependencyInjection/Tests/CrossCheckTest.php | 2 +-
src/Symfony/Component/Form/Util/OrderedHashMap.php | 2 +-
src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php | 2 +-
src/Symfony/Component/Validator/Constraints/File.php | 12 +++++++-----
7 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 778d0e9..39627e2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,8 +26,9 @@ matrix:
- php: 5.4
- php: 5.5
- php: 5.6
- env: deps=high
- php: 7.0
+ env: deps=high
+ - php: 7.1
env: deps=low
fast_finish: true
@@ -50,13 +51,12 @@ before_install:
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
- - if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.10 && echo apc.enable_cli = 1 >> $INI_FILE); fi
- - if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.2 && echo apc.enable_cli = 1 >> $INI_FILE); fi
+ - if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi
+ - if [[ ! $skip && $PHP = 7.0 ]]; then (echo yes | pecl install -f apcu-5.1.5 && echo apc.enable_cli = 1 >> $INI_FILE); fi
- 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
- if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
- - if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini; fi
- - if [[ ! $skip ]]; then composer self-update --stable; fi
+ - if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
- if [[ ! $skip ]]; then cp .composer/* ~/.composer/; fi
- if [[ ! $skip ]]; then ./phpunit install; fi
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt
index e2775cf..a0e3642 100644
--- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt
+++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_structure.txt
@@ -23,5 +23,5 @@ class ProjectServiceContainer extends Container
}
}
-class stdClass_%s extends \stdClass implements \ProxyManager\%s
-{%a}%A
\ No newline at end of file
+class stdClass_%s extends %SstdClass implements \ProxyManager\%s
+{%a}%A
diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php
index 13e4c3c..b019435 100644
--- a/src/Symfony/Component/Console/Helper/Table.php
+++ b/src/Symfony/Component/Console/Helper/Table.php
@@ -448,7 +448,7 @@ class Table
}
// create a two dimensional array (rowspan x colspan)
- $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, ''), $unmergedRows);
+ $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
$value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
index 7905e7f..423c5db 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php
@@ -34,7 +34,7 @@ class CrossCheckTest extends \PHPUnit_Framework_TestCase
$loaderClass = 'Symfony\\Component\\DependencyInjection\\Loader\\'.ucfirst($type).'FileLoader';
$dumperClass = 'Symfony\\Component\\DependencyInjection\\Dumper\\'.ucfirst($type).'Dumper';
- $tmp = tempnam('sf_service_container', 'sf');
+ $tmp = tempnam(sys_get_temp_dir(), 'sf');
file_put_contents($tmp, file_get_contents(self::$fixturesPath.'/'.$type.'/'.$fixture));
diff --git a/src/Symfony/Component/Form/Util/OrderedHashMap.php b/src/Symfony/Component/Form/Util/OrderedHashMap.php
index 2ba53e2..48581e8 100644
--- a/src/Symfony/Component/Form/Util/OrderedHashMap.php
+++ b/src/Symfony/Component/Form/Util/OrderedHashMap.php
@@ -140,7 +140,7 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable
? 0
// Imitate PHP's behavior of generating a key that equals
// the highest existing integer key + 1
- : max($this->orderedKeys) + 1;
+ : 1 + (int) max($this->orderedKeys);
}
$this->orderedKeys[] = $key;
diff --git a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php
index 948b3ff..dba35a6 100644
--- a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php
+++ b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php
@@ -20,7 +20,7 @@ abstract class CacheWarmer implements CacheWarmerInterface
{
protected function writeCacheFile($file, $content)
{
- $tmpFile = tempnam(dirname($file), basename($file));
+ $tmpFile = @tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
@chmod($file, 0666 & ~umask());
diff --git a/src/Symfony/Component/Validator/Constraints/File.php b/src/Symfony/Component/Validator/Constraints/File.php
index 24c7495..341fbaf 100644
--- a/src/Symfony/Component/Validator/Constraints/File.php
+++ b/src/Symfony/Component/Validator/Constraints/File.php
@@ -88,20 +88,22 @@ class File extends Constraint
private function normalizeBinaryFormat($maxSize)
{
+ $sizeInt = (int) $maxSize;
+
if (ctype_digit((string) $maxSize)) {
- $this->maxSize = (int) $maxSize;
+ $this->maxSize = $sizeInt;
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
} elseif (preg_match('/^\d++k$/i', $maxSize)) {
- $this->maxSize = $maxSize * 1000;
+ $this->maxSize = $sizeInt * 1000;
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
} elseif (preg_match('/^\d++M$/i', $maxSize)) {
- $this->maxSize = $maxSize * 1000000;
+ $this->maxSize = $sizeInt * 1000000;
$this->binaryFormat = null === $this->binaryFormat ? false : $this->binaryFormat;
} elseif (preg_match('/^\d++Ki$/i', $maxSize)) {
- $this->maxSize = $maxSize << 10;
+ $this->maxSize = $sizeInt << 10;
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
} elseif (preg_match('/^\d++Mi$/i', $maxSize)) {
- $this->maxSize = $maxSize << 20;
+ $this->maxSize = $sizeInt << 20;
$this->binaryFormat = null === $this->binaryFormat ? true : $this->binaryFormat;
} else {
throw new ConstraintDefinitionException(sprintf('"%s" is not a valid maximum size', $this->maxSize));
|