From 1487f08c6dc00861a225e1e15467e77a662452d0 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 21 May 2026 10:38:18 -0400 Subject: [PATCH] Add unzip to required build tools When an extension declares `download-url-method: ["pre-packaged-binary", ...]`, PIE calls `setDistUrl(zip-url)` so composer downloads and extracts the .so into the vendor dir. composer's archive downloader probes for `/usr/bin/unzip` first. When it isn't present, composer doesn't fall back to PHP's ZipArchive; it falls back to git-cloning the source. The prebuilt dist is silently discarded, the .so never lands in the vendor dir, and `UnixBuild::prePackagedBinary` trips `ExtensionBinaryNotFound` looking for it. `php:X.Y-cli` Debian images don't ship `/usr/bin/unzip`, so this hits any `pie install ` on a minimal container when the extension publishes prebuilt binaries. Adds `unzip` to `CheckAllBuildTools::buildToolsFactory()` alongside the existing tools. Package name is `unzip` on apt/apk/dnf/yum/brew. With `--auto-install-build-tools`, PIE installs it and the prebuilt-binary lane works. Caught while releasing iliaal/fastchart 1.1.1. --- .../BuildTools/CheckAllBuildTools.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/SelfManage/BuildTools/CheckAllBuildTools.php b/src/SelfManage/BuildTools/CheckAllBuildTools.php index ac02c6ab..c0220129 100644 --- a/src/SelfManage/BuildTools/CheckAllBuildTools.php +++ b/src/SelfManage/BuildTools/CheckAllBuildTools.php @@ -70,6 +70,25 @@ public static function buildToolsFactory(): self PackageManager::Brew->value => 'libtool', ], ), + // Composer's archive downloader uses /usr/bin/unzip first + // and falls back to git-source-cloning when it isn't + // present (not to PHP's ZipArchive). Without unzip, a + // pre-packaged-binary dist URL is silently swapped for a + // git clone of the source tree and the .so the user paid + // for in download time is never extracted, surfacing as + // ExtensionBinaryNotFound when PIE's prePackagedBinary + // check looks for it in the vendor dir. Bare php:X.Y-cli + // Debian images do not ship /usr/bin/unzip. + new BinaryBuildToolFinder( + 'unzip', + [ + PackageManager::Apt->value => 'unzip', + PackageManager::Apk->value => 'unzip', + PackageManager::Dnf->value => 'unzip', + PackageManager::Yum->value => 'unzip', + PackageManager::Brew->value => 'unzip', + ], + ), new PhpizeBuildToolFinder( [ PackageManager::Apt->value => 'php-dev',