Skip to content

Commit 1487f08

Browse files
committed
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 <pkg>` 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.
1 parent 2d228f1 commit 1487f08

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/SelfManage/BuildTools/CheckAllBuildTools.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ public static function buildToolsFactory(): self
7070
PackageManager::Brew->value => 'libtool',
7171
],
7272
),
73+
// Composer's archive downloader uses /usr/bin/unzip first
74+
// and falls back to git-source-cloning when it isn't
75+
// present (not to PHP's ZipArchive). Without unzip, a
76+
// pre-packaged-binary dist URL is silently swapped for a
77+
// git clone of the source tree and the .so the user paid
78+
// for in download time is never extracted, surfacing as
79+
// ExtensionBinaryNotFound when PIE's prePackagedBinary
80+
// check looks for it in the vendor dir. Bare php:X.Y-cli
81+
// Debian images do not ship /usr/bin/unzip.
82+
new BinaryBuildToolFinder(
83+
'unzip',
84+
[
85+
PackageManager::Apt->value => 'unzip',
86+
PackageManager::Apk->value => 'unzip',
87+
PackageManager::Dnf->value => 'unzip',
88+
PackageManager::Yum->value => 'unzip',
89+
PackageManager::Brew->value => 'unzip',
90+
],
91+
),
7392
new PhpizeBuildToolFinder(
7493
[
7594
PackageManager::Apt->value => 'php-dev',

0 commit comments

Comments
 (0)