Skip to content

Add unzip to required build tools#619

Merged
asgrim merged 1 commit into
php:1.5.xfrom
iliaal:fix/unzip-build-tool
May 26, 2026
Merged

Add unzip to required build tools#619
asgrim merged 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.
@asgrim asgrim self-requested a review May 26, 2026 08:16
@asgrim asgrim self-assigned this May 26, 2026
@asgrim asgrim added the enhancement New feature or request label May 26, 2026
@asgrim asgrim added this to the 1.5.0 milestone May 26, 2026
@asgrim
Copy link
Copy Markdown
Contributor

asgrim commented May 26, 2026

Thanks @iliaal ! This will land in 1.5.0 eventually :)

@asgrim asgrim merged commit 9a20a16 into php:1.5.x May 26, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants