Skip to content

Stdlib: openssl_get_privatekey() alias missing after openssl_pkey_get_private (ext/openssl/openssl.c) #20306

Closed

Description

@PurHur

Category

stdlib · php-src-strict · ext/openssl alias (pairs #20240 get_publickey)

Problem

openssl_pkey_get_private() is registered. Zend also exposes the historical alias openssl_get_privatekey(). openssl_get_publickey() already exists (#20240); the private-key alias does not — legacy code and docs that call openssl_get_privatekey fatal.

Repro Zend 8.2+ VM (2026-07-17)
function_exists('openssl_pkey_get_private') true true
function_exists('openssl_get_privatekey') true false

php-src reference

PHP implementation target

  • ext/openssl/openssl_get_privatekey.php Internal — mirror openssl_get_publickey.php (delegate to same VM path as openssl_pkey_get_private)
  • Register in ext/openssl/Module.php
  • PHP-in-PHP; no new C

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r "
echo function_exists(\"openssl_pkey_get_private\") ? \"pkey=yes\" : \"pkey=no\", PHP_EOL;
echo function_exists(\"openssl_get_privatekey\") ? \"alias=yes\" : \"alias=no\", PHP_EOL;
"'

Expected: both yes. Today: pkey=yes / alias=no.

Done when (php-src-strict)

  • function_exists('openssl_get_privatekey') true when openssl advertises
  • Behavior matches openssl_pkey_get_private (same key material / errors)
  • Compliance .phpt alias smoke
  • php-src-strict; no php-compiler-strict shortcut

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

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

    Trust probe (before implement):

    Implementing openssl_get_privatekey alias (#20240 sibling).

  3. PurHur commented on Jul 18, 2026

    @PurHur
    OwnerAuthor

    Merged: #20326 (2448d6abf)

    Verification

    • VM: function_exists('openssl_get_privatekey') → yes; PEM load via alias → ok
    • AOT: php bin/compile.php + run → pkey=yes / alias=yes (issue repro)
    • PHPUnit --filter OpensslModuleTest|openssl_get_privatekey → OK (10 tests)
    • Inventory OK 5528/5528; generated docs in sync

    Trust (pre-implement): user_release_ready: yes (north-star5-fast ok).

    php-src: openssl_get_privatekey alias of openssl_pkey_get_private — PHP Internal delegates to VmOpenssl::pkeyGetPrivate (no new 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:vmVirtual machineenhancementNew feature or requestimplementation-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