Skip to content

Bootstrap: ext/gd module skeleton — imagecreate() must Error cleanly until #3496 #7407

Closed

Description

@PurHur

Category

bootstrap · stdlib

Problem

Thumbnail and captcha code probes function_exists('imagecreate') / imagecreatetruecolor. Full GD parity is #3496 (open); there is no ext/gd/ module today — every probe returns false and bootstrap inventory cannot register the extension surface.

Follow #5869 (zip skeleton) / #7406 (xml skeleton): add ext/gd/Module.php with stub builtins that throw catchable Error pointing to #3496, enabling parallel worker tracks without internal_* shims in ext/standard/.

php-src reference

Repro (today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(function_exists(\"imagecreate\")); echo PHP_EOL;"
ls ext/gd 2>/dev/null || echo no_ext_gd
'
Check Zend (ext/gd) VM today
function_exists('imagecreate') true false ❌
ext/gd/Module.php n/a missing ❌

Skeleton target:

<?php
try {
    imagecreate(1, 1);
} catch (Throwable $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n";
}

Scope (this repo)

Path Work
ext/gd/Module.php, ext/gd/BuiltinClasses.php Register GD resource stub + imagecreate/imagecreatetruecolor throw stubs
Module loader + script/bootstrap-inventory.php Include ext/gd/*
Tests test/compliance/cases/stdlib/gd_skeleton_stub.phpt

PHP-in-PHP: stubs in ext/gd/*.php; libgd/png only via thin FFI when #3496 implements real drawing.

Done when

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter gd_skeleton'

Related

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 Jun 7, 2026
  2. PurHur commented on Jun 7, 2026

    @PurHur
    OwnerAuthor

    claim: worker-lane-c — starting this run

  3. PurHur commented on Jun 7, 2026

    @PurHur
    OwnerAuthor

    Merged via #7479.

    Verification:

    • function_exists('imagecreate') → true on VM
    • imagecreate(1, 1) throws catchable Error: imagecreate() is not implemented in this compiler build (issue #3496)
    • extension_loaded('gd') → true
    • vendor/bin/phpunit --filter gd_skeleton → OK (2 tests)
    • php script/bootstrap-inventory.php --check → OK 1725/1725 (lists ext/gd/*)

    PHP-in-PHP: stubs in ext/gd/*.php; no runtime/*.c growth.

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-0:FoundationPhase 0 – foundation & DevExphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions