Skip to content

Commit b84eb44

Browse files
committed
Use --with-libxml instead of --enable-libxml for PHP 7.4
1 parent 0c5ad4e commit b84eb44

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

src/PhpBrew/VariantBuilder.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -727,13 +727,21 @@ public function __construct()
727727
$this->variants['xml'] = function (Build $build) {
728728
$options = array(
729729
'--enable-dom',
730-
'--enable-libxml',
730+
);
731+
732+
if ($build->compareVersion('7.4') < 0) {
733+
$options[] = '--enable-libxml';
734+
} else {
735+
$options[] = '--with-libxml';
736+
}
737+
738+
$options = array_merge($options, array(
731739
'--enable-simplexml',
732740
'--enable-xml',
733741
'--enable-xmlreader',
734742
'--enable-xmlwriter',
735743
'--with-xsl',
736-
);
744+
));
737745

738746
do {
739747
if ($bin = Utils::findBin('brew')) {

tests/PhpBrew/VariantBuilderTest.php

+27
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,31 @@ public function testNeutralVirtualVariant()
164164
});
165165
$this->assertEquals(array(), $actual);
166166
}
167+
168+
/**
169+
* @param string $version
170+
* @param string $expected
171+
*
172+
* @dataProvider libXmlProvider
173+
*/
174+
public function testLibXml($version, $expected)
175+
{
176+
$build = new Build($version);
177+
$build->enableVariant('xml');
178+
179+
$builder = new VariantBuilder();
180+
$options = $builder->build($build);
181+
182+
$this->assertContains($expected, $options);
183+
}
184+
185+
public static function libXmlProvider()
186+
{
187+
return array(
188+
array('7.3.0', '--enable-libxml'),
189+
190+
// see https://github.com/php/php-src/pull/4037
191+
array('7.4.0-dev', '--with-libxml'),
192+
);
193+
}
167194
}

0 commit comments

Comments
 (0)