Skip to content

Commit ad346ae

Browse files
authored
Merge pull request phpbrew#1210 from flavioheleno/fix/php8-zts
Update ZTS variant for PHP8 build
2 parents 01e73db + d855d81 commit ad346ae

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/PhpBrew/VariantBuilder.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ public function __construct()
153153
$this->variants['ftp'] = '--enable-ftp';
154154
$this->variants['filter'] = '--enable-filter';
155155
$this->variants['gcov'] = '--enable-gcov';
156-
$this->variants['zts'] = '--enable-maintainer-zts';
156+
$this->variants['zts'] = function (ConfigureParameters $params, Build $build) {
157+
if ($build->compareVersion('8.0') < 0) {
158+
return $params->withOption('--enable-maintainer-zts');
159+
}
160+
161+
return $params->withOption('--enable-zts');
162+
};
157163

158164
$this->variants['json'] = '--enable-json';
159165
$this->variants['hash'] = '--enable-hash';

tests/PhpBrew/VariantBuilderTest.php

+32
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,36 @@ public static function zipProvider()
294294
array('7.4.0-dev', '--with-zip'),
295295
);
296296
}
297+
298+
/**
299+
* @param string $version
300+
* @param string $expected
301+
*
302+
* @dataProvider ztsProvider
303+
*/
304+
public function testZts($version, $expected)
305+
{
306+
$build = new Build($version);
307+
$build->enableVariant('zts');
308+
309+
$builder = new VariantBuilder();
310+
$options = $builder->build($build)->getOptions();
311+
312+
$this->assertArrayHasKey($expected, $options);
313+
}
314+
315+
public static function ztsProvider()
316+
{
317+
return array(
318+
array('5.3.0', '--enable-maintainer-zts'),
319+
array('5.4.0', '--enable-maintainer-zts'),
320+
array('5.5.0', '--enable-maintainer-zts'),
321+
array('5.6.0', '--enable-maintainer-zts'),
322+
array('7.0.0', '--enable-maintainer-zts'),
323+
array('7.1.0', '--enable-maintainer-zts'),
324+
array('7.3.0', '--enable-maintainer-zts'),
325+
array('7.4.0', '--enable-maintainer-zts'),
326+
array('8.0.0', '--enable-zts'),
327+
);
328+
}
297329
}

0 commit comments

Comments
 (0)