Skip to content

Commit 5fd0fe6

Browse files
committed
bug #23711 Fix support for PHP 7.2 (Simperfit, nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- Fix support for PHP 7.2 | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | #23671 | License | MIT | Doc PR | - There are still the deprecation problem with phpunit since it use `each()`. There are 3 tests linked to session that I don't know how to fix / what to do, do you have any idea @nicolas-grekas ? Commits ------- fdf285b Fix 7.2 compat layer e229dd0 Fix PHP 7.2 support
2 parents 1b1f39a + fdf285b commit 5fd0fe6

File tree

17 files changed

+46
-26
lines changed

17 files changed

+46
-26
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ matrix:
2525
- php: 5.5
2626
- php: 5.6
2727
- php: 7.0
28-
env: deps=high
2928
- php: 7.1
29+
env: deps=high
30+
- php: 7.2
3031
env: deps=low
3132
fast_finish: true
3233

src/Symfony/Bridge/Twig/Tests/AppVariableTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public function testEnvironment()
4444
$this->assertEquals('dev', $this->appVariable->getEnvironment());
4545
}
4646

47+
/**
48+
* @runInSeparateProcess
49+
*/
4750
public function testGetSession()
4851
{
4952
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"symfony/asset": "~2.7",
2424
"symfony/finder": "~2.3",
2525
"symfony/form": "~2.7.30|^2.8.23",
26+
"symfony/http-foundation": "~2.7.36|^2.8.29",
2627
"symfony/http-kernel": "~2.3",
2728
"symfony/intl": "~2.3",
2829
"symfony/routing": "~2.2",

src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup()
5555
$finder = new Finder();
5656
$metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta');
5757
// simply check that cache is warmed up
58-
$this->assertGreaterThanOrEqual(1, count($metaFiles));
58+
$this->assertNotEmpty($metaFiles);
5959
foreach ($metaFiles as $file) {
6060
$configCache = new ConfigCache(substr($file, 0, -5), true);
6161
$this->assertTrue(

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ public function testRedirectToRoute()
143143
$this->assertSame(302, $response->getStatusCode());
144144
}
145145

146+
/**
147+
* @runInSeparateProcess
148+
*/
146149
public function testAddFlash()
147150
{
148151
$flashBag = new FlashBag();

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"symfony/config": "~2.4",
2424
"symfony/event-dispatcher": "~2.5",
2525
"symfony/finder": "^2.0.5",
26-
"symfony/http-foundation": "~2.7",
26+
"symfony/http-foundation": "~2.7.36|^2.8.29",
2727
"symfony/http-kernel": "~2.7.29|^2.8.22",
2828
"symfony/filesystem": "~2.3",
2929
"symfony/routing": "~2.7.24|^2.8.17",

src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ public function testNotice()
7979
$this->assertEquals(E_NOTICE, $exception->getSeverity());
8080
$this->assertEquals(__FILE__, $exception->getFile());
8181
$this->assertRegExp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage());
82-
$this->assertArrayHasKey('foobar', $exception->getContext());
82+
if (\PHP_VERSION_ID < 70200) {
83+
$this->assertArrayHasKey('foobar', $exception->getContext());
84+
}
8385

8486
$trace = $exception->getTrace();
8587
$this->assertEquals(__FILE__, $trace[0]['file']);
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<?php
22

3-
throw new \Exception('boo');
3+
if (!function_exists('__phpunit_run_isolated_test')) {
4+
throw new \Exception('boo');
5+
}

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ public function testExtensionInPhar()
421421
if (extension_loaded('suhosin') && false === strpos(ini_get('suhosin.executor.include.whitelist'), 'phar')) {
422422
$this->markTestSkipped('To run this test, add "phar" to the "suhosin.executor.include.whitelist" settings in your php.ini file.');
423423
}
424+
if (defined('HHVM_VERSION')) {
425+
$this->markTestSkipped('HHVM makes this test conflict with those run in separate processes.');
426+
}
424427

425428
require_once self::$fixturesPath.'/includes/ProjectWithXsdExtensionInPhar.phar';
426429

src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/LegacyDefaultCsrfProviderTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ class LegacyDefaultCsrfProviderTest extends TestCase
2323
{
2424
protected $provider;
2525

26-
public static function setUpBeforeClass()
27-
{
28-
ini_set('session.save_handler', 'files');
29-
ini_set('session.save_path', sys_get_temp_dir());
30-
}
31-
3226
protected function setUp()
3327
{
3428
$this->provider = new DefaultCsrfProvider('SECRET');

0 commit comments

Comments
 (0)