Repository navigation
Stdlib: openssl_pkey_get_public() JIT/AOT happy-path leftover of #33499 — PEM/key → OpenSSLAsymmetricKey (ext/openssl/openssl.c) #34038
Copy link
Copy link
Closed
Labels
area:compilerCompiler / CFG / JITCompiler / CFG / JITbugSomething isn't workingSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsstdlib
Description
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/php-src
ext/openssl/openssl.c—PHP_FUNCTION(openssl_pkey_get_public) - php/php-src
ext/openssl/openssl.stub.php—openssl_pkey_get_public(OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $public_key): OpenSSLAsymmetricKey|false
PHP implementation target
ext/openssl/openssl_pkey_get_public.php— accept value-box/unknown (peer Stdlib: openssl_pkey_get_details() JIT/AOT happy-path leftover of #33496 — details array AOT (ext/openssl/openssl.c) #34030); replace LogicException with NestedJIT / thin AOT- Reuse
__phpc_ossl_pkey_details_publeaf fromJitOpensslPkeyGetDetailsKernel(Stdlib: openssl_pkey_get_details() JIT/AOT happy-path leftover of #33496 — details array AOT (ext/openssl/openssl.c) #34030) to normalize PEM → public PEM, wrapOpenSSLAsymmetricKey(__osslPem) - Alias
openssl_get_publickeyshould share the path - Prefer PHP-in-PHP — no new
runtime/*.c
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
OpenSSLAsymmetricKeyobject also works -
./script/aot-smoke.shstays 8/8 - Repro under
test/repro/
Parent
- Leftover of Stdlib: openssl_pkey_get_public() JIT leftover of #20240 — AOT LogicException (ext/openssl/openssl.c) #33499 (argc/TypeError only)
- Follows Stdlib: openssl_pkey_get_details() JIT/AOT happy-path leftover of #33496 — details array AOT (ext/openssl/openssl.c) #34030 (
openssl_pkey_get_detailshappy-path) / Stdlib: openssl_pkey_new() JIT/AOT happy-path leftover of #33530 — OpenSSLAsymmetricKey object AOT (ext/openssl/openssl.c) #34015 (openssl_pkey_new)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:compilerCompiler / CFG / JITCompiler / CFG / JITbugSomething isn't workingSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsPhase 4 – stdlib for web appsstdlib
Activity
PurHur commentedon Aug 23, 2026
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.
Stdlib: openssl_pkey_get_public thin AOT via DETAILS_PUB leaf (#34038)
Docs: refresh capability matrix after openssl_pkey_get_public AOT (#3…
PurHur commentedon Aug 23, 2026
merged: #34041
Fix: thin AOT
JitOpensslPkeyGetPublicreuses#34030__phpc_ossl_pkey_details_pub; accept value-box PEMs; aliasopenssl_get_publickey.Verified:
./script/aot-smoke.sh→ 8/8./script/phpunit.sh --filter Issue34038OpensslPkeyGetPublicHappyPathAotTest→ OK (3 tests, 14 assertions)ok|alias-okStdlib: openssl_pkey_get_public thin AOT via DETAILS_PUB leaf (#34038)
Docs: refresh capability matrix after openssl_pkey_get_public AOT (#3…
Stdlib: openssl_pkey_get_public thin AOT via DETAILS_PUB leaf (#34038) (