Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Command/InstallExtensionsForProjectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
use function is_string;
use function realpath;
use function sprintf;
use function strtolower;

use const PHP_EOL;

Expand Down Expand Up @@ -152,7 +153,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
),
);

$phpEnabledExtensions = array_keys($targetPlatform->phpBinaryPath->extensions());
$phpEnabledExtensions = array_map('strtolower', array_keys($targetPlatform->phpBinaryPath->extensions()));
$installedPiePackages = $this->installedPiePackages->allPiePackages($pieComposer);

$anyErrorsHappened = false;
Expand All @@ -177,7 +178,7 @@ function (Link $link) use ($pieComposer, $phpEnabledExtensions, $installedPiePac
);
}

if (in_array($extension->name(), $phpEnabledExtensions)) {
if (in_array(strtolower($extension->name()), $phpEnabledExtensions)) {
if ($piePackageVersion !== null && $piePackageVersionMatchesLinkConstraint === false) {
$this->io->write(sprintf(
'%s: <comment>%s:%s</comment> %s Version %s is installed, but does not meet the version requirement %s',
Expand Down
5 changes: 5 additions & 0 deletions src/Command/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ function (string $version, string $phpExtensionName) use ($composer, $rootPackag
$packageRequirement = $rootPackageRequires[$piePackage->name()]->getPrettyConstraint();

try {
// Don't check for updates for bundled PHP extensions
if ($piePackage->isBundledPhpExtension()) {
throw new BundledPhpExtensionRefusal();
}

Assert::stringNotEmpty($packageName);
Assert::stringNotEmpty($packageRequirement);

Expand Down
5 changes: 5 additions & 0 deletions src/Platform/InstalledPiePackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ static function (BasePackage $basePackage): bool {
/** @return non-empty-string */
static function (Package $package): string {
return match ($package->extensionName()->name()) {
'core' => 'Core',
'spl' => 'SPL',
'phar' => 'Phar',
'reflection' => 'Reflection',
'pdo' => 'PDO',
'ffi' => 'FFI',
'opcache' => 'Zend OPcache',
'simplexml' => 'SimpleXML',
Expand Down
1 change: 1 addition & 0 deletions test/install-bundled-php-exts.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static function (PackageInterface $package) use ($phpVersionConstraint): bool {
}
}

echo Process::run([$phpBinaryPath->phpBinaryPath, '-m'], timeout: 60);
echo Process::run(['bin/pie', 'show', '--with-php-config=' . $phpBinaryPath->phpConfigPath()], timeout: 60);

if ($anyFailures) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function testInstallingExtensionsForPhpProject(): void
$rootPackage = new RootPackage('my/project', '1.2.3.0', '1.2.3');
$rootPackage->setRequires([
'ext-standard' => new Link('my/project', 'ext-standard', new Constraint('=', '*'), Link::TYPE_REQUIRE, '*'),
'ext-spl' => new Link('my/project', 'ext-spl', new Constraint('=', '*'), Link::TYPE_REQUIRE, '*'),
'ext-foobar' => new Link('my/project', 'ext-foobar', new MultiConstraint([
new Constraint('>=', '1.2.0.0-dev'),
new Constraint('<', '2.0.0.0-dev'),
Expand Down Expand Up @@ -137,6 +138,7 @@ public function testInstallingExtensionsForPhpProject(): void
$this->commandTester->assertCommandIsSuccessful($outputString);
self::assertStringContainsString('Checking extensions for your project my/project', $outputString);
self::assertStringContainsString('requires: ext-standard:* ✅ Already installed', $outputString);
self::assertStringContainsString('requires: ext-spl:* ✅ Already installed', $outputString);
self::assertStringContainsString('requires: ext-foobar:^1.2 🚫 Missing', $outputString);
}

Expand Down