Skip to content

Stdlib: ZipArchive class missing — ext/zip read/write API not registered (ext/zip/php_zip.c) #19492

Closed

Description

@PurHur

Category

stdlib · php-src-strict · archive extension

Problem

php-src ships ext/zip with the ZipArchive class (open, addFromString, extractTo, …). This compiler has no ZipArchive registration — class_exists('ZipArchive') is false on VM even when the Zend reference build has ext/zip enabled. Apps using .zip iteration/compression cannot run.

Repro Zend (ext/zip loaded) VM (2026-07-16)
class_exists('ZipArchive') true false
new ZipArchive() object Fatal: class not found

php-src reference

PHP implementation target

  • New ext/zip/ module: Module.php, ZipArchiveBuiltin.php, VmZip.php — PHP lowering + thin native read/write only if unavoidable
  • Register in bootstrap module list; extension_loaded('zip') policy aligned with ModuleRegistry
  • Prefer PHP-in-PHP archive logic or libzip FFI wrapper; avoid growing runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php -r "var_export(class_exists(\"ZipArchive\")); echo \"\\n\";"'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r "var_export(class_exists(\"ZipArchive\")); echo \"\\n\";"'

Done when

  • ZipArchive class registered; open/addFromString/close/numFiles work on minimal in-memory/temp archive
  • extension_loaded('zip') matches Zend advertisement policy
  • Compliance .phpt under test/compliance/cases/zip/
  • Capability matrix row for core ZipArchive methods
  • php-src-strict

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 16, 2026
  2. PurHur commented on Jul 16, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler Ext — I/O & Crypto — starting this run

    Pre-triage gates:

    Scope: #19492 — ZipArchive already implemented under PHP_COMPILER_PROFILE=8.4 (CompilerVersion::supportsZip); reference profile correctly withholds per #18137. Closing gaps: count()/Countable, forward-profile compliance, unit-test skip without profile.

  3. PurHur commented on Jul 16, 2026

    @PurHur
    OwnerAuthor

    Merged #19520

    Done-when:

    Verify:

    PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/ziparchive_forward_profile.php
    PHP_COMPILER_PROFILE=8.4 php vendor/bin/phpunit --filter ziparchive_forward_profile test/compliance/VMTest.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions