Skip to content

Stdlib/JIT: spl_autoload() / spl_autoload_functions() / spl_autoload_extensions() unsupported #9048

Description

@PurHur

Category

stdlib + JIT — php-src-strict

Problem

spl_autoload(), spl_autoload_functions(), and spl_autoload_extensions() are registered on VM but JIT/AOT throw LogicException (“not implemented for JIT”). Web apps and Composer-style autoloaders that run under bin/jit.php or AOT binaries cannot register or list autoload callbacks.

VM already stores callbacks via VmSplAutoload; JIT must read/write the same list without a parallel LLVM autoload table.

php-src reference

Repro

test/repro/maintainer_spl_autoload_jit.php:

<?php
spl_autoload_register(function (string $c): void {
    echo "autoload:$c\n";
});
try {
    new DoesNotExist();
} catch (Throwable $e) {
    // expected
}
var_dump(is_array(spl_autoload_functions()));
# Zend reference
php test/repro/maintainer_spl_autoload_jit.php

# VM (works today)
./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_spl_autoload_jit.php

# JIT (fails today — target of this issue)
./script/docker-exec.sh -- php bin/jit.php test/repro/maintainer_spl_autoload_jit.php

Zend / VM: prints autoload:DoesNotExist and bool(true) for spl_autoload_functions().

JIT today: spl_autoload_register() is not implemented for JIT in this compiler build (#4256) (same family for spl_autoload / spl_autoload_extensions).

Scope (this repo)

Path Work
ext/standard/spl_autoload*.php VM handlers (existing)
ext/standard/VmSplAutoload.php SSOT callback list
lib/JIT/Builtin/JitSplAutoload.php Implement JIT lowering (no new runtime/*.c)
Tests test/compliance/cases/stdlib/spl_autoload_jit.phpt

Done when (php-src-strict)

  • Repro passes on bin/jit.php and AOT when in scope
  • spl_autoload_register() default handler, prepend flag, and spl_autoload_functions() ordering match Zend
  • spl_autoload_extensions() getter/setter parity
  • VM path unchanged (no regression)
  • ./script/ci-local.sh --filter spl_autoload green

Related

Activity

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:compilerCompiler / CFG / JITenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions