Skip to content

AOT: openssl_pkey_new($options) runtime array still LogicException — leftover of #34015 (ext/openssl/openssl.c) #35866

Description

@PurHur

Category

bug · AOT · php-src-strict · leftover of #34015

Problem

#34015 shipped the happy path for openssl_pkey_new() / openssl_pkey_new(null) and inline compile-time options arrays. A runtime options variable still aborts compile:

openssl_pkey_new() options must be compile-time null/?array for JIT/AOT in this compiler build (issue #34015)

Documented in ext/openssl/openssl_pkey_new.php as #34015 follow-up.

Repro Zend 8.2+ / VM AOT thin (master)
openssl_pkey_new(['private_key_bits'=>512, ...]) inline OpenSSLAsymmetricKey / 512 OK
$opts=[...]; openssl_pkey_new($opts) same compile LogicException

./script/aot-smoke.sh is 8/8 — feature gap, not the linker.

php-src reference

PHP implementation target

  • ext/openssl/openssl_pkey_new.php / JitOpensslPkeyNew.php — when foldCompileTimeOptions returns null, lower hashtable options via dimFetch + existing JitOpensslPkeyKernel / NestedJIT generate (runtime bits Value). No new runtime/*.c.

Repro

./script/docker-exec.sh -- bash -lc 'cat >/tmp/pk_rt.php <<'\''EOF'\''
<?php
$bits = 512;
$opts = ["private_key_bits" => $bits, "private_key_type" => OPENSSL_KEYTYPE_RSA];
$k = openssl_pkey_new($opts);
echo get_class($k), " ", openssl_pkey_get_details($k)["bits"], "\n";
EOF
php bin/vm.php /tmp/pk_rt.php
PHP_COMPILER_HELPER_RUNTIME_O=0 php bin/compile.php -o /tmp/pk_rt.bin /tmp/pk_rt.php && /tmp/pk_rt.bin'

Done when

  • AOT compile+run of the runtime-$opts repro matches VM/Zend (OpenSSLAsymmetricKey 512)
  • Existing Issue34015OpensslPkeyNewHappyPathAotTest still green
  • ./script/aot-smoke.sh stays 8/8
  • No new runtime/*.c

Activity

  1. added
    bugSomething isn't working
    phase-4:stdlibPhase 4 – stdlib for web apps
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 30, 2026
  2. PurHur commented on Aug 30, 2026

    @PurHur
    OwnerAuthor

    claim: implementing AOT openssl_pkey_new($opts) runtime array leftover of #34015 this run (foldCompileTimeOptions null → hashtable/dimFetch + existing kernel).

  3. PurHur commented on Aug 30, 2026

    @PurHur
    OwnerAuthor

    claim: implementer-worker-lane-B — taking over this run (35866 % 3 == 1 is native lane B; prior claim has no remote branch/PR after ~12m). Starting runtime-$opts openssl_pkey_new AOT lowering.

  4. PurHur commented on Aug 30, 2026

    @PurHur
    OwnerAuthor

    merged in #35875

    verification:

    • ./script/aot-smoke.sh → 8/8
    • ./script/phpunit.sh --filter 'Issue35866OpensslPkeyNewRuntimeOptsAotTest|Issue34015OpensslPkeyNewHappyPathAotTest' → OK (6 tests, 29 assertions)
    • O=0 compile+run test/repro/issue_35866_openssl_pkey_new_runtime_opts.php → OpenSSLAsymmetricKey 512

    fix: generateFromRuntimeOptions — Hashtable dimFetch of bits/type + existing EVP RSA keygen leaf (no new runtime/*.c).

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 / JITbugSomething isn't workingimplementation-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