From 53d78570928db0d2934581ee0ef26cdb365f7899 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Thu, 5 Oct 2017 21:36:40 -0400 Subject: [PATCH 01/10] Use for=ID on radio/checkbox label. This is required for some screen reader like Jaws --- .../Twig/Resources/views/Form/bootstrap_3_layout.html.twig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig index 3e9f133d37..2efc0c4d4a 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_layout.html.twig @@ -148,10 +148,14 @@ {% endblock %} {% block checkbox_label -%} + {%- set label_attr = label_attr|merge({'for': id}) -%} + {{- block('checkbox_radio_label') -}} {%- endblock checkbox_label %} {% block radio_label -%} + {%- set label_attr = label_attr|merge({'for': id}) -%} + {{- block('checkbox_radio_label') -}} {%- endblock radio_label %} From 214105647180dd640a4c207afcaea670198848ef Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Fri, 6 Oct 2017 09:50:51 +0100 Subject: [PATCH 02/10] Escape command usage when displaying it in the text descriptor --- src/Symfony/Component/Console/Descriptor/TextDescriptor.php | 2 +- src/Symfony/Component/Console/Tests/Fixtures/command_2.txt | 6 +++--- .../Component/Console/Tests/Fixtures/command_mbstring.txt | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php index 5b82b3deef..249eb9cb84 100644 --- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php @@ -143,7 +143,7 @@ class TextDescriptor extends Descriptor $this->writeText('Usage:', $options); foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) { $this->writeText("\n"); - $this->writeText(' '.$usage, $options); + $this->writeText(' '.OutputFormatter::escape($usage), $options); } $this->writeText("\n"); diff --git a/src/Symfony/Component/Console/Tests/Fixtures/command_2.txt b/src/Symfony/Component/Console/Tests/Fixtures/command_2.txt index cad9cb45f2..2864c7bdc3 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/command_2.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/command_2.txt @@ -1,7 +1,7 @@ Usage: - descriptor:command2 [options] [--] - descriptor:command2 -o|--option_name - descriptor:command2 + descriptor:command2 [options] [--] \ + descriptor:command2 -o|--option_name \ + descriptor:command2 \ Arguments: argument_name diff --git a/src/Symfony/Component/Console/Tests/Fixtures/command_mbstring.txt b/src/Symfony/Component/Console/Tests/Fixtures/command_mbstring.txt index 969a065242..cde457dcab 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/command_mbstring.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/command_mbstring.txt @@ -1,7 +1,7 @@ Usage: - descriptor:åèä [options] [--] - descriptor:åèä -o|--option_name - descriptor:åèä + descriptor:åèä [options] [--] \ + descriptor:åèä -o|--option_name \ + descriptor:åèä \ Arguments: argument_åèä From 042eac4624f24b38edfa4d93c4e9e075a74cd3e9 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 6 Oct 2017 13:28:39 +0200 Subject: [PATCH 03/10] [Form] fix parsing invalid floating point numbers --- .../PercentToLocalizedStringTransformer.php | 33 ++++++++- ...ercentToLocalizedStringTransformerTest.php | 70 ++++++++++++++++++- 2 files changed, 98 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php index ad8baeb7c9..fdb142f84e 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php @@ -116,6 +116,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface return; } + $position = 0; $formatter = $this->getNumberFormatter(); $groupSep = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL); $decSep = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL); @@ -129,18 +130,44 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface $value = str_replace(',', $decSep, $value); } + if (false !== strpos($value, $decSep)) { + $type = \NumberFormatter::TYPE_DOUBLE; + } else { + $type = \PHP_INT_SIZE === 8 ? \NumberFormatter::TYPE_INT64 : \NumberFormatter::TYPE_INT32; + } + // replace normal spaces so that the formatter can read them - $value = $formatter->parse(str_replace(' ', "\xc2\xa0", $value)); + $result = $formatter->parse(str_replace(' ', "\xc2\xa0", $value), $type, $position); if (intl_is_failure($formatter->getErrorCode())) { throw new TransformationFailedException($formatter->getErrorMessage()); } if (self::FRACTIONAL == $this->type) { - $value /= 100; + $result /= 100; } - return $value; + if (\function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($value, null, true)) { + $length = mb_strlen($value, $encoding); + $remainder = mb_substr($value, $position, $length, $encoding); + } else { + $length = \strlen($value); + $remainder = substr($value, $position, $length); + } + + // After parsing, position holds the index of the character where the + // parsing stopped + if ($position < $length) { + // Check if there are unrecognized characters at the end of the + // number (excluding whitespace characters) + $remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0"); + + if ('' !== $remainder) { + throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s"', $remainder)); + } + } + + return $result; } /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php index 24cef424d1..3467e891c9 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php @@ -141,10 +141,10 @@ class PercentToLocalizedStringTransformerTest extends TestCase */ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot() { - // Since we test against "de_AT", we need the full implementation + // Since we test against "de_DE", we need the full implementation IntlTestHelper::requireFullIntl($this, '4.8.1.1'); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $transformer = new PercentToLocalizedStringTransformer(1, 'integer'); @@ -236,4 +236,70 @@ class PercentToLocalizedStringTransformerTest extends TestCase $this->assertEquals(1234.5, $transformer->reverseTransform('1234,5')); $this->assertEquals(1234.5, $transformer->reverseTransform('1234.5')); } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + */ + public function testReverseTransformDisallowsLeadingExtraCharacters() + { + $transformer = new PercentToLocalizedStringTransformer(); + + $transformer->reverseTransform('foo123'); + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + * @expectedExceptionMessage The number contains unrecognized characters: "foo3" + */ + public function testReverseTransformDisallowsCenteredExtraCharacters() + { + $transformer = new PercentToLocalizedStringTransformer(); + + $transformer->reverseTransform('12foo3'); + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + * @expectedExceptionMessage The number contains unrecognized characters: "foo8" + * @requires extension mbstring + */ + public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte() + { + // Since we test against other locales, we need the full implementation + IntlTestHelper::requireFullIntl($this, false); + + \Locale::setDefault('ru'); + + $transformer = new PercentToLocalizedStringTransformer(); + + $transformer->reverseTransform("12\xc2\xa0345,67foo8"); + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + * @expectedExceptionMessage The number contains unrecognized characters: "foo" + */ + public function testReverseTransformDisallowsTrailingExtraCharacters() + { + $transformer = new PercentToLocalizedStringTransformer(); + + $transformer->reverseTransform('123foo'); + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + * @expectedExceptionMessage The number contains unrecognized characters: "foo" + * @requires extension mbstring + */ + public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte() + { + // Since we test against other locales, we need the full implementation + IntlTestHelper::requireFullIntl($this, false); + + \Locale::setDefault('ru'); + + $transformer = new PercentToLocalizedStringTransformer(); + + $transformer->reverseTransform("12\xc2\xa0345,678foo"); + } } From 1f76a70b6f2cd597e922250b12cb8f89ca67d53b Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Sun, 8 Oct 2017 16:27:20 +0200 Subject: [PATCH 04/10] [HttpFoundation] Combine Cache-Control headers --- src/Symfony/Component/HttpFoundation/HeaderBag.php | 2 +- .../HttpFoundation/Tests/ResponseHeaderBagTest.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index a824ed8649..a797d7a2e6 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -146,7 +146,7 @@ class HeaderBag implements \IteratorAggregate, \Countable } if ('cache-control' === $key) { - $this->cacheControl = $this->parseCacheControl($values[0]); + $this->cacheControl = $this->parseCacheControl(implode(', ', $this->headers[$key])); } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php index debcdc1faf..c55a7f6a51 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php @@ -110,6 +110,17 @@ class ResponseHeaderBagTest extends TestCase $bag = new ResponseHeaderBag(); $bag->set('Last-Modified', 'abcde'); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); + + $bag = new ResponseHeaderBag(); + $bag->set('Cache-Control', array('public', 'must-revalidate')); + $this->assertCount(1, $bag->get('Cache-Control', null, false)); + $this->assertEquals('must-revalidate, public', $bag->get('Cache-Control')); + + $bag = new ResponseHeaderBag(); + $bag->set('Cache-Control', 'public'); + $bag->set('Cache-Control', 'must-revalidate', false); + $this->assertCount(1, $bag->get('Cache-Control', null, false)); + $this->assertEquals('must-revalidate, public', $bag->get('Cache-Control')); } public function testToStringIncludesCookieHeaders() From dbc9a44333d34d9262c7f2cefa2c756fa1cc3da8 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 9 Oct 2017 11:21:24 +0200 Subject: [PATCH 05/10] [HttpFoundation] Add missing session.lazy_write config option --- .../HttpFoundation/Session/Storage/NativeSessionStorage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 5888323bd7..9bf438c159 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -76,6 +76,7 @@ class NativeSessionStorage implements SessionStorageInterface * gc_probability, "1" * hash_bits_per_character, "4" * hash_function, "0" + * lazy_write, "1" * name, "PHPSESSID" * referer_check, "" * serialize_handler, "php" @@ -337,7 +338,7 @@ class NativeSessionStorage implements SessionStorageInterface 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'entropy_file', 'entropy_length', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character', - 'hash_function', 'name', 'referer_check', + 'hash_function', 'lazy_write', 'name', 'referer_check', 'serialize_handler', 'use_strict_mode', 'use_cookies', 'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled', 'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name', From e229dd03021b35c4288f01a72f1955218e68abc8 Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Sat, 29 Jul 2017 11:14:02 +0200 Subject: [PATCH 06/10] Fix PHP 7.2 support --- .github/build-packages.php | 1 - .travis.yml | 8 ++-- .../LegacyDefaultCsrfProviderTest.php | 6 ++- .../Session/Storage/NativeSessionStorage.php | 18 ++++++--- .../Storage/Handler/PdoSessionHandlerTest.php | 38 +++++++++++++++++++ .../Storage/NativeSessionStorageTest.php | 2 +- .../EventListener/LocaleListenerTest.php | 6 ++- .../EventListener/TestSessionListenerTest.php | 2 +- .../NativeSessionTokenStorageTest.php | 6 ++- 9 files changed, 69 insertions(+), 18 deletions(-) diff --git a/.github/build-packages.php b/.github/build-packages.php index 56112b753a..3d186e927c 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -9,7 +9,6 @@ chdir(dirname(__DIR__)); $dirs = $_SERVER['argv']; array_shift($dirs); $mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs)))); - $packages = array(); $flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0; diff --git a/.travis.yml b/.travis.yml index e01ab63ab3..8409baaf05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ matrix: - php: 7.0 env: deps=high - php: 7.1 - env: deps=low + - php: 7.2 fast_finish: true cache: @@ -137,7 +137,7 @@ install: export SYMFONY_DEPRECATIONS_HELPER=weak && cp composer.json composer.json.orig && echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json && - php .github/build-packages.php HEAD^ $COMPONENTS && + (php .github/build-packages.php HEAD^ $COMPONENTS) && mv composer.json composer.json.phpunit && mv composer.json.orig composer.json fi @@ -176,9 +176,9 @@ install: if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m" elif [[ $deps = high ]]; then - echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" + echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && ($COMPOSER_UP) && $PHPUNIT_X$LEGACY'" elif [[ $deps = low ]]; then - echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" + echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && ($COMPOSER_UP --prefer-lowest --prefer-stable) && $PHPUNIT_X'" elif [[ $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data else diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php index 824e81c553..c22bd46a7b 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php @@ -25,8 +25,10 @@ class LegacyDefaultCsrfProviderTest extends TestCase public static function setUpBeforeClass() { - ini_set('session.save_handler', 'files'); - ini_set('session.save_path', sys_get_temp_dir()); + if (\PHP_VERSION_ID < 70200) { + ini_set('session.save_handler', 'files'); + ini_set('session.save_path', sys_get_temp_dir()); + } } protected function setUp() diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 5888323bd7..1ee6d3f34e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -101,8 +101,12 @@ class NativeSessionStorage implements SessionStorageInterface */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { - session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used) - ini_set('session.use_cookies', 1); + if (empty($options)) { + $options += array('cache_limiter' => 'public'); + } + if (1 !== (int) ini_get('session.use_cookies')) { + ini_set('session.use_cookies', 1); + } if (\PHP_VERSION_ID >= 50400) { session_register_shutdown(); @@ -345,9 +349,11 @@ class NativeSessionStorage implements SessionStorageInterface 'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags', )); - foreach ($options as $key => $value) { - if (isset($validOptions[$key])) { - ini_set('session.'.$key, $value); + if (PHP_VERSION_ID < 70200 || !headers_sent()) { + foreach ($options as $key => $value) { + if (isset($validOptions[$key])) { + ini_set('session.'.$key, $value); + } } } } @@ -392,7 +398,7 @@ class NativeSessionStorage implements SessionStorageInterface } $this->saveHandler = $saveHandler; - if ($this->saveHandler instanceof \SessionHandlerInterface) { + if ($this->saveHandler instanceof \SessionHandlerInterface && false === headers_sent()) { if (\PHP_VERSION_ID >= 50400) { session_set_save_handler($this->saveHandler, false); } else { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index a47120f180..88509b11b9 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -271,6 +271,10 @@ class PdoSessionHandlerTest extends TestCase public function testSessionGC() { + if (\PHP_VERSION_ID >= 70200) { + $this->markTestSkipped('PHP version is 7.2'); + } + $previousLifeTime = ini_set('session.gc_maxlifetime', 1000); $pdo = $this->getMemorySqlitePdo(); $storage = new PdoSessionHandler($pdo); @@ -282,10 +286,12 @@ class PdoSessionHandlerTest extends TestCase $storage->open('', 'sid'); $storage->read('gc_id'); + // IN 7.2 this does not work ini_set('session.gc_maxlifetime', -1); // test that you can set lifetime of a session after it has been read $storage->write('gc_id', 'data'); $storage->close(); $this->assertEquals(2, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'No session pruned because gc not called'); + $storage->destroy('gc_id'); $storage->open('', 'sid'); $data = $storage->read('gc_id'); @@ -293,7 +299,39 @@ class PdoSessionHandlerTest extends TestCase $storage->close(); ini_set('session.gc_maxlifetime', $previousLifeTime); + $this->assertSame('', $data, 'Session already considered garbage, so not returning data even if it is not pruned yet'); + $this->assertEquals(1, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'Expired session is pruned'); + } + public function testSessionGC72() + { + if (\PHP_VERSION_ID <= 70200) { + $this->markTestSkipped('PHP version is not 7.2'); + } + + $previousLifeTime = false === headers_sent() && ini_set('session.gc_maxlifetime', 1000); + $pdo = $this->getMemorySqlitePdo(); + $storage = new PdoSessionHandler($pdo); + + $storage->open('', 'sid'); + $storage->read('id'); + $storage->write('id', 'data'); + $storage->close(); + + $storage->open('', 'sid'); + $storage->read('gc_id'); + false === headers_sent() && ini_set('session.gc_maxlifetime', -1); // test that you can set lifetime of a session after it has been read + $storage->write('gc_id', 'data'); + $storage->close(); + $this->assertEquals(2, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'No session pruned because gc not called'); + true === headers_sent() && $storage->destroy('gc_id'); + + $storage->open('', 'sid'); + $data = $storage->read('gc_id'); + $storage->gc(-1); + $storage->close(); + + false === headers_sent() && ini_set('session.gc_maxlifetime', $previousLifeTime); $this->assertSame('', $data, 'Session already considered garbage, so not returning data even if it is not pruned yet'); $this->assertEquals(1, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'Expired session is pruned'); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 20f9ca060b..d5281c644d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -152,7 +152,7 @@ class NativeSessionStorageTest extends TestCase { $this->iniSet('session.cache_limiter', 'nocache'); - $storage = new NativeSessionStorage(); + $storage = new NativeSessionStorage(array('cache_limiter' => '')); $this->assertEquals('', ini_get('session.cache_limiter')); } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index b6977ea88b..24f9038f35 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -38,7 +38,11 @@ class LocaleListenerTest extends TestCase public function testLocaleFromRequestAttribute() { $request = Request::create('/'); - session_name('foo'); + + if (PHP_VERSION_ID < 70200 || !headers_sent()) { + session_name('foo'); + } + $request->cookies->set('foo', 'value'); $request->attributes->set('_locale', 'es'); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php index 52794e0272..63d5338182 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php @@ -63,7 +63,7 @@ class TestSessionListenerTest extends TestCase $this->sessionHasBeenStarted(); $params = session_get_cookie_params(); - session_set_cookie_params(0, $params['path'], $params['domain'], $params['secure'], $params['httponly']); + // session_set_cookie_params(0, $params['path'], $params['domain'], $params['secure'], $params['httponly']); $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST); $cookies = $response->headers->getCookies(); diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php index ea20cff529..869f14f82e 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php @@ -31,8 +31,10 @@ class NativeSessionTokenStorageTest extends TestCase public static function setUpBeforeClass() { - ini_set('session.save_handler', 'files'); - ini_set('session.save_path', sys_get_temp_dir()); + if (\PHP_VERSION_ID < 70200) { + ini_set('session.save_handler', 'files'); + ini_set('session.save_path', sys_get_temp_dir()); + } parent::setUpBeforeClass(); } From fdf285b5c9a85b2cbd9d569ed1682bf7f12e014a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 9 Oct 2017 12:39:15 +0200 Subject: [PATCH 07/10] Fix 7.2 compat layer --- .github/build-packages.php | 1 + .travis.yml | 9 ++-- .../Bridge/Twig/Tests/AppVariableTest.php | 3 ++ src/Symfony/Bridge/Twig/composer.json | 1 + .../CacheClearCommandTest.php | 2 +- .../Tests/Controller/ControllerTest.php | 3 ++ .../Bundle/FrameworkBundle/composer.json | 2 +- .../Debug/Tests/ErrorHandlerTest.php | 4 +- .../Debug/Tests/Fixtures/Throwing.php | 4 +- .../Tests/Loader/XmlFileLoaderTest.php | 3 ++ .../LegacyDefaultCsrfProviderTest.php | 8 ---- .../Session/Storage/NativeSessionStorage.php | 33 +++++++++------ .../Storage/Handler/PdoSessionHandlerTest.php | 41 ++----------------- .../Storage/NativeSessionStorageTest.php | 2 +- .../EventListener/LocaleListenerTest.php | 7 +--- .../EventListener/TestSessionListenerTest.php | 3 +- .../Component/HttpKernel/composer.json | 2 +- .../Routing/Tests/Fixtures/validresource.php | 3 ++ .../NativeSessionTokenStorageTest.php | 10 ----- 19 files changed, 55 insertions(+), 86 deletions(-) diff --git a/.github/build-packages.php b/.github/build-packages.php index 3d186e927c..56112b753a 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -9,6 +9,7 @@ chdir(dirname(__DIR__)); $dirs = $_SERVER['argv']; array_shift($dirs); $mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs)))); + $packages = array(); $flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0; diff --git a/.travis.yml b/.travis.yml index 8409baaf05..e34ba5a8bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,9 +25,10 @@ matrix: - php: 5.5 - php: 5.6 - php: 7.0 - env: deps=high - php: 7.1 + env: deps=high - php: 7.2 + env: deps=low fast_finish: true cache: @@ -137,7 +138,7 @@ install: export SYMFONY_DEPRECATIONS_HELPER=weak && cp composer.json composer.json.orig && echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json && - (php .github/build-packages.php HEAD^ $COMPONENTS) && + php .github/build-packages.php HEAD^ $COMPONENTS && mv composer.json composer.json.phpunit && mv composer.json.orig composer.json fi @@ -176,9 +177,9 @@ install: if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m" elif [[ $deps = high ]]; then - echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && ($COMPOSER_UP) && $PHPUNIT_X$LEGACY'" + echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" elif [[ $deps = low ]]; then - echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && ($COMPOSER_UP --prefer-lowest --prefer-stable) && $PHPUNIT_X'" + echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" elif [[ $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data else diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php index 9abb0e3b6e..b9aa168fd7 100644 --- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -44,6 +44,9 @@ class AppVariableTest extends TestCase $this->assertEquals('dev', $this->appVariable->getEnvironment()); } + /** + * @runInSeparateProcess + */ public function testGetSession() { $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json index 9610edc808..04e3819176 100644 --- a/src/Symfony/Bridge/Twig/composer.json +++ b/src/Symfony/Bridge/Twig/composer.json @@ -23,6 +23,7 @@ "symfony/asset": "~2.7", "symfony/finder": "~2.3", "symfony/form": "~2.7.30|^2.8.23", + "symfony/http-foundation": "~2.7.36|^2.8.29", "symfony/http-kernel": "~2.3", "symfony/intl": "~2.3", "symfony/routing": "~2.2", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php index f1140e86bb..a25aa8e637 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php @@ -55,7 +55,7 @@ class CacheClearCommandTest extends TestCase $finder = new Finder(); $metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta'); // simply check that cache is warmed up - $this->assertGreaterThanOrEqual(1, count($metaFiles)); + $this->assertNotEmpty($metaFiles); foreach ($metaFiles as $file) { $configCache = new ConfigCache(substr($file, 0, -5), true); $this->assertTrue( diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php index d7f40a24d8..cb813c61d6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php @@ -143,6 +143,9 @@ class ControllerTest extends TestCase $this->assertSame(302, $response->getStatusCode()); } + /** + * @runInSeparateProcess + */ public function testAddFlash() { $flashBag = new FlashBag(); diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 76648774f3..ed611114fe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -23,7 +23,7 @@ "symfony/config": "~2.4", "symfony/event-dispatcher": "~2.5", "symfony/finder": "^2.0.5", - "symfony/http-foundation": "~2.7", + "symfony/http-foundation": "~2.7.36|^2.8.29", "symfony/http-kernel": "~2.7.29|^2.8.22", "symfony/filesystem": "~2.3", "symfony/routing": "~2.7.24|^2.8.17", diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php index 898a985a29..fd9ac577ee 100644 --- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php @@ -79,7 +79,9 @@ class ErrorHandlerTest extends TestCase $this->assertEquals(E_NOTICE, $exception->getSeverity()); $this->assertEquals(__FILE__, $exception->getFile()); $this->assertRegExp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage()); - $this->assertArrayHasKey('foobar', $exception->getContext()); + if (\PHP_VERSION_ID < 70200) { + $this->assertArrayHasKey('foobar', $exception->getContext()); + } $trace = $exception->getTrace(); $this->assertEquals(__FILE__, $trace[0]['file']); diff --git a/src/Symfony/Component/Debug/Tests/Fixtures/Throwing.php b/src/Symfony/Component/Debug/Tests/Fixtures/Throwing.php index 21e0aba17d..d338ca9d57 100644 --- a/src/Symfony/Component/Debug/Tests/Fixtures/Throwing.php +++ b/src/Symfony/Component/Debug/Tests/Fixtures/Throwing.php @@ -1,3 +1,5 @@ markTestSkipped('To run this test, add "phar" to the "suhosin.executor.include.whitelist" settings in your php.ini file.'); } + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('HHVM makes this test conflict with those run in separate processes.'); + } require_once self::$fixturesPath.'/includes/ProjectWithXsdExtensionInPhar.phar'; diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php index c22bd46a7b..8cca486369 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php @@ -23,14 +23,6 @@ class LegacyDefaultCsrfProviderTest extends TestCase { protected $provider; - public static function setUpBeforeClass() - { - if (\PHP_VERSION_ID < 70200) { - ini_set('session.save_handler', 'files'); - ini_set('session.save_path', sys_get_temp_dir()); - } - } - protected function setUp() { $this->provider = new DefaultCsrfProvider('SECRET'); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 1ee6d3f34e..09cb242f92 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -101,12 +101,11 @@ class NativeSessionStorage implements SessionStorageInterface */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { - if (empty($options)) { - $options += array('cache_limiter' => 'public'); - } - if (1 !== (int) ini_get('session.use_cookies')) { - ini_set('session.use_cookies', 1); - } + $options += array( + // disable by default because it's managed by HeaderBag (if used) + 'cache_limiter' => '', + 'use_cookies' => 1, + ); if (\PHP_VERSION_ID >= 50400) { session_register_shutdown(); @@ -212,6 +211,10 @@ class NativeSessionStorage implements SessionStorageInterface return false; } + if (headers_sent()) { + return false; + } + if (null !== $lifetime) { ini_set('session.cookie_lifetime', $lifetime); } @@ -336,6 +339,10 @@ class NativeSessionStorage implements SessionStorageInterface */ public function setOptions(array $options) { + if (headers_sent()) { + return; + } + $validOptions = array_flip(array( 'cache_limiter', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', @@ -349,11 +356,9 @@ class NativeSessionStorage implements SessionStorageInterface 'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags', )); - if (PHP_VERSION_ID < 70200 || !headers_sent()) { - foreach ($options as $key => $value) { - if (isset($validOptions[$key])) { - ini_set('session.'.$key, $value); - } + foreach ($options as $key => $value) { + if (isset($validOptions[$key])) { + ini_set('session.'.$key, $value); } } } @@ -389,6 +394,10 @@ class NativeSessionStorage implements SessionStorageInterface throw new \InvalidArgumentException('Must be instance of AbstractProxy or NativeSessionHandler; implement \SessionHandlerInterface; or be null.'); } + if (headers_sent($file, $line)) { + throw new \RuntimeException(sprintf('Failed to set the session handler because headers have already been sent by "%s" at line %d.', $file, $line)); + } + // Wrap $saveHandler in proxy and prevent double wrapping of proxy if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) { $saveHandler = new SessionHandlerProxy($saveHandler); @@ -398,7 +407,7 @@ class NativeSessionStorage implements SessionStorageInterface } $this->saveHandler = $saveHandler; - if ($this->saveHandler instanceof \SessionHandlerInterface && false === headers_sent()) { + if ($this->saveHandler instanceof \SessionHandlerInterface) { if (\PHP_VERSION_ID >= 50400) { session_set_save_handler($this->saveHandler, false); } else { diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 88509b11b9..a9884c1c92 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -269,12 +269,11 @@ class PdoSessionHandlerTest extends TestCase $this->assertSame('', $data, 'Destroyed session returns empty string'); } + /** + * @runInSeparateProcess + */ public function testSessionGC() { - if (\PHP_VERSION_ID >= 70200) { - $this->markTestSkipped('PHP version is 7.2'); - } - $previousLifeTime = ini_set('session.gc_maxlifetime', 1000); $pdo = $this->getMemorySqlitePdo(); $storage = new PdoSessionHandler($pdo); @@ -286,12 +285,10 @@ class PdoSessionHandlerTest extends TestCase $storage->open('', 'sid'); $storage->read('gc_id'); - // IN 7.2 this does not work ini_set('session.gc_maxlifetime', -1); // test that you can set lifetime of a session after it has been read $storage->write('gc_id', 'data'); $storage->close(); $this->assertEquals(2, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'No session pruned because gc not called'); - $storage->destroy('gc_id'); $storage->open('', 'sid'); $data = $storage->read('gc_id'); @@ -299,39 +296,7 @@ class PdoSessionHandlerTest extends TestCase $storage->close(); ini_set('session.gc_maxlifetime', $previousLifeTime); - $this->assertSame('', $data, 'Session already considered garbage, so not returning data even if it is not pruned yet'); - $this->assertEquals(1, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'Expired session is pruned'); - } - public function testSessionGC72() - { - if (\PHP_VERSION_ID <= 70200) { - $this->markTestSkipped('PHP version is not 7.2'); - } - - $previousLifeTime = false === headers_sent() && ini_set('session.gc_maxlifetime', 1000); - $pdo = $this->getMemorySqlitePdo(); - $storage = new PdoSessionHandler($pdo); - - $storage->open('', 'sid'); - $storage->read('id'); - $storage->write('id', 'data'); - $storage->close(); - - $storage->open('', 'sid'); - $storage->read('gc_id'); - false === headers_sent() && ini_set('session.gc_maxlifetime', -1); // test that you can set lifetime of a session after it has been read - $storage->write('gc_id', 'data'); - $storage->close(); - $this->assertEquals(2, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'No session pruned because gc not called'); - true === headers_sent() && $storage->destroy('gc_id'); - - $storage->open('', 'sid'); - $data = $storage->read('gc_id'); - $storage->gc(-1); - $storage->close(); - - false === headers_sent() && ini_set('session.gc_maxlifetime', $previousLifeTime); $this->assertSame('', $data, 'Session already considered garbage, so not returning data even if it is not pruned yet'); $this->assertEquals(1, $pdo->query('SELECT COUNT(*) FROM sessions')->fetchColumn(), 'Expired session is pruned'); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index d5281c644d..20f9ca060b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -152,7 +152,7 @@ class NativeSessionStorageTest extends TestCase { $this->iniSet('session.cache_limiter', 'nocache'); - $storage = new NativeSessionStorage(array('cache_limiter' => '')); + $storage = new NativeSessionStorage(); $this->assertEquals('', ini_get('session.cache_limiter')); } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index 24f9038f35..1898ee0863 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -38,12 +38,7 @@ class LocaleListenerTest extends TestCase public function testLocaleFromRequestAttribute() { $request = Request::create('/'); - - if (PHP_VERSION_ID < 70200 || !headers_sent()) { - session_name('foo'); - } - - $request->cookies->set('foo', 'value'); + $request->cookies->set(session_name(), 'value'); $request->attributes->set('_locale', 'es'); $listener = new LocaleListener('fr', null, $this->requestStack); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php index 63d5338182..47ee153342 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/TestSessionListenerTest.php @@ -62,8 +62,7 @@ class TestSessionListenerTest extends TestCase { $this->sessionHasBeenStarted(); - $params = session_get_cookie_params(); - // session_set_cookie_params(0, $params['path'], $params['domain'], $params['secure'], $params['httponly']); + @ini_set('session.cookie_lifetime', 0); $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST); $cookies = $response->headers->getCookies(); diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json index 6b6ec3f17b..1b6b096a8a 100644 --- a/src/Symfony/Component/HttpKernel/composer.json +++ b/src/Symfony/Component/HttpKernel/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.3.9", "symfony/event-dispatcher": "^2.6.7", - "symfony/http-foundation": "~2.7.20|^2.8.13", + "symfony/http-foundation": "~2.7.36|^2.8.29", "symfony/debug": "^2.6.2", "psr/log": "~1.0" }, diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/validresource.php b/src/Symfony/Component/Routing/Tests/Fixtures/validresource.php index 482c80b29e..f59a234d65 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/validresource.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/validresource.php @@ -1,5 +1,8 @@ import('validpattern.php'); diff --git a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php index 869f14f82e..d7931c09b2 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/TokenStorage/NativeSessionTokenStorageTest.php @@ -29,16 +29,6 @@ class NativeSessionTokenStorageTest extends TestCase */ private $storage; - public static function setUpBeforeClass() - { - if (\PHP_VERSION_ID < 70200) { - ini_set('session.save_handler', 'files'); - ini_set('session.save_path', sys_get_temp_dir()); - } - - parent::setUpBeforeClass(); - } - protected function setUp() { $_SESSION = array(); From e71c4f71f54f30f32b49d45948055d30178f2b5d Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 10 Oct 2017 12:05:53 +0200 Subject: [PATCH 08/10] fix merge --- .../Tests/Compiler/OptionalServiceClass.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php index 7e9238f223..3337269590 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php @@ -13,6 +13,8 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler; use Symfony\Bug\NotExistClass; -class OptionalServiceClass extends NotExistClass -{ +if (!function_exists('__phpunit_run_isolated_test')) { + class OptionalServiceClass extends NotExistClass + { + } } From 6595615255847fdc88243e38e730e473b13ef4b6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 10 Oct 2017 12:32:49 +0200 Subject: [PATCH 09/10] fix merge --- src/Symfony/Bridge/Twig/Tests/AppVariableTest.php | 6 ++++++ .../FrameworkBundle/Tests/Fixtures/Validation/Article.php | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php index accbf1c682..9071a3e4f7 100644 --- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -168,6 +168,9 @@ class AppVariableTest extends TestCase $this->assertEquals(array(), $this->appVariable->getFlashes()); } + /** + * @runInSeparateProcess + */ public function testGetFlashesWithNoSessionStarted() { $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock(); @@ -178,6 +181,9 @@ class AppVariableTest extends TestCase $this->assertEquals(array(), $this->appVariable->getFlashes()); } + /** + * @runInSeparateProcess + */ public function testGetFlashes() { $flashMessages = $this->setFlashMessages(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php index a1ecee6d0b..5f28d0648f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php @@ -2,7 +2,9 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation; -class Article implements NotExistingInterface -{ - public $category; +if (!function_exists('__phpunit_run_isolated_test')) { + class Article implements NotExistingInterface + { + public $category; + } } From 9719fba0ab5f1abcfd21af0a3702c1e24903d8c3 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 10 Oct 2017 12:34:18 +0200 Subject: [PATCH 10/10] fix merge --- src/Symfony/Component/Config/Tests/Fixtures/BadParent.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php b/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php index 68d7296ed8..3f9720bb8a 100644 --- a/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php +++ b/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php @@ -2,6 +2,8 @@ namespace Symfony\Component\Config\Tests\Fixtures; -class BadParent extends MissingParent -{ +if (!function_exists('__phpunit_run_isolated_test')) { + class BadParent extends MissingParent + { + } }