diff --git a/src/Command/InstallExtensionsForProjectCommand.php b/src/Command/InstallExtensionsForProjectCommand.php index d1e1063..0d0303a 100644 --- a/src/Command/InstallExtensionsForProjectCommand.php +++ b/src/Command/InstallExtensionsForProjectCommand.php @@ -45,6 +45,7 @@ use function is_string; use function realpath; use function sprintf; +use function strtolower; use const PHP_EOL; @@ -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; @@ -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: %s:%s %s Version %s is installed, but does not meet the version requirement %s', diff --git a/src/Command/ShowCommand.php b/src/Command/ShowCommand.php index 2218bb6..77f88b9 100644 --- a/src/Command/ShowCommand.php +++ b/src/Command/ShowCommand.php @@ -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); diff --git a/src/Platform/InstalledPiePackages.php b/src/Platform/InstalledPiePackages.php index 3473d6b..efc2353 100644 --- a/src/Platform/InstalledPiePackages.php +++ b/src/Platform/InstalledPiePackages.php @@ -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', diff --git a/test/install-bundled-php-exts.php b/test/install-bundled-php-exts.php index 7e6e674..2913525 100644 --- a/test/install-bundled-php-exts.php +++ b/test/install-bundled-php-exts.php @@ -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) { diff --git a/test/integration/Command/InstallExtensionsForProjectCommandTest.php b/test/integration/Command/InstallExtensionsForProjectCommandTest.php index 0952295..7e1b767 100644 --- a/test/integration/Command/InstallExtensionsForProjectCommandTest.php +++ b/test/integration/Command/InstallExtensionsForProjectCommandTest.php @@ -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'), @@ -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); }