Skip to content

Stdlib: openssl_pkey_get_public() JIT/AOT happy-path leftover of #33499 — PEM/key → OpenSSLAsymmetricKey (ext/openssl/openssl.c) #34038

Closed

Description

@PurHur

Category

bug · AOT unimplemented · php-src-strict · leftover of #33499 / #20240

Problem

#33499 baked catchable argc/TypeError paths for openssl_pkey_get_public(), but the happy path still throws at compile time (LogicException) or, after chaining openssl_pkey_get_details()['key'], rejects the value-box PEM as mixed at runtime.

Thin AOT cannot load a public key from PEM / OpenSSLAsymmetricKey produced by openssl_pkey_new() + openssl_pkey_get_details() (#34030), which blocks real TLS/crypto programs.

Repro Zend 8.2+ / VM AOT thin (master @ 1c7dfaf)
$d=openssl_pkey_get_details(openssl_pkey_new(['private_key_bits'=>512])); $p=openssl_pkey_get_public($d['key']); echo is_object($p)?'ok':'fail'; ok TypeError mixed given (rc=255)
compile-time string PEM literal object compile LogicException or TypeError

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

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'printf "%s\n" "<?php" "\$d=openssl_pkey_get_details(openssl_pkey_new([\"private_key_bits\"=>512]));" "\$p=openssl_pkey_get_public(\$d[\"key\"]);" "echo is_object(\$p)?\"ok\":\"fail\", PHP_EOL;" > /tmp/gp.php; php bin/vm.php /tmp/gp.php; PHP_COMPILER_HELPER_RUNTIME_O=0 php bin/compile.php -o /tmp/gp.bin /tmp/gp.php && /tmp/gp.bin'

Done when

  • AOT openssl_pkey_get_public(openssl_pkey_get_details(openssl_pkey_new())['key']) returns object (rc=0)
  • AOT from OpenSSLAsymmetricKey object also works
  • ./script/aot-smoke.sh stays 8/8
  • Repro under test/repro/

Parent

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

    @PurHur
    OwnerAuthor

    claim: PHP runtime migration specialist — leftover of #33499 after #34030/#34035. Reuse DETAILS_PUB leaf; no new runtime/*.c. Branch agent/issue-34038-openssl-pkey-get-public.

  3. PurHur commented on Aug 23, 2026

    @PurHur
    OwnerAuthor

    merged: #34041

    Fix: thin AOT JitOpensslPkeyGetPublic reuses #34030 __phpc_ossl_pkey_details_pub; accept value-box PEMs; alias openssl_get_publickey.

    Verified:

    • ./script/aot-smoke.sh → 8/8
    • ./script/phpunit.sh --filter Issue34038OpensslPkeyGetPublicHappyPathAotTest → OK (3 tests, 14 assertions)
    • repro AOT → ok|alias-ok
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 appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions