Skip to content

Add unzip to required build tools#619

Open
iliaal wants to merge 1 commit into
php:1.5.xfrom
iliaal:fix/unzip-build-tool
Open

Add unzip to required build tools#619
iliaal wants to merge 1 commit into
php:1.5.xfrom
iliaal:fix/unzip-build-tool

Conversation

@iliaal
Copy link
Copy Markdown
Contributor

@iliaal iliaal commented May 21, 2026

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. Repro:

docker run --rm php:8.4-cli sh -c '
    apt-get update -qq
    apt-get install -y -qq curl git ca-certificates  # no unzip
    curl -sSL https://github.com/php/pie/releases/download/1.4.4/pie.phar \
        -o /usr/local/bin/pie && chmod +x /usr/local/bin/pie
    pie install --with-php-config=/usr/local/bin/php-config \
        --auto-install-build-tools iliaal/fastchart'

The patch 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant