From c14843ffdb34c7e27706dff917691be24aad2f79 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Mon, 27 Oct 2025 09:11:10 -0500 Subject: [PATCH 1/2] Ensure case insensitive extension name matching is used in pie install command --- src/Command/InstallExtensionsForProjectCommand.php | 5 +++-- .../Command/InstallExtensionsForProjectCommandTest.php | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Command/InstallExtensionsForProjectCommand.php b/src/Command/InstallExtensionsForProjectCommand.php index d1e1063f..0d0303a5 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/test/integration/Command/InstallExtensionsForProjectCommandTest.php b/test/integration/Command/InstallExtensionsForProjectCommandTest.php index 09522955..7e1b7676 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); } From 0aa422860de914dea1affefc1e0b58e84a411788 Mon Sep 17 00:00:00 2001 From: James Titcumb Date: Mon, 27 Oct 2025 09:26:10 -0500 Subject: [PATCH 2/2] Improve case/ext name conversion in pie show --- src/Command/ShowCommand.php | 5 +++++ src/Platform/InstalledPiePackages.php | 5 +++++ test/install-bundled-php-exts.php | 1 + 3 files changed, 11 insertions(+) diff --git a/src/Command/ShowCommand.php b/src/Command/ShowCommand.php index 2218bb66..77f88b9f 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 3473d6b2..efc2353d 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 7e6e6747..29135253 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) {