Skip to content

Stdlib: pgsql legacy aliases (pg_exec/pg_numrows/…) missing after modern names (ext/pgsql/pgsql.c) #22219

Closed

Description

@PurHur

Category

enhancement · php-src-strict · ext/pgsql

Problem

Zend ext/pgsql still registers legacy aliases for older PHP/pgsql spellings (pg_exec, pg_numrows, pg_cmdtuples, pg_fieldname, lo_* short names, …). php-compiler already implements the modern names (pg_query, pg_num_rows, pg_affected_rows, pg_field_name, pg_lo_open, …) but aliases are absent (function_exists false on VM; true on Zend 8.2+ with pgsql). Sibling pattern: openssl alias fix #20306 / stream aliases #20903.

Alias Modern (VM has) Alias function_exists VM (2026-07-22) Zend
pg_exec pg_query Y N Y
pg_numrows pg_num_rows Y N Y
pg_numfields pg_num_fields Y N Y
pg_cmdtuples pg_affected_rows Y N Y
pg_fieldname / pg_fieldnum / pg_fieldsize / pg_fieldtype / pg_fieldprtlen / pg_fieldisnull modern pg_field_* Y N Y
pg_freeresult pg_free_result Y N Y
pg_getlastoid pg_last_oid Y N Y
pg_clientencoding / pg_setclientencoding modern encoding helpers Y N Y
pg_errormessage pg_last_error Y N Y
pg_loopen / pg_loclose / pg_locreate / pg_loread / pg_lowrite / pg_lounlink / pg_loimport / pg_loexport / pg_loreadall modern pg_lo_* Y N Y
pg_result pg_result_status Y N Y

Legacy code and PEAR-era scripts call the old names; they must resolve to the same handlers as Zend.

php-src reference

PHP implementation target

  • ext/pgsql/Module.php — register aliases pointing at existing Internal classes (same pattern as other ext alias registrations)
  • Do not duplicate execute bodies; one handler, two names
  • Confirm get_defined_functions() / function_exists / reflection name match Zend alias reporting

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r '"'"'
foreach (["pg_exec","pg_query","pg_numrows","pg_num_rows","pg_cmdtuples","pg_affected_rows"] as $f) {
  echo $f, "=", function_exists($f) ? "Y" : "N", "\n";
}
'"'"''
# compare with host php -r '…'

Done when

  • All listed aliases function_exists true and invoke the modern implementations
  • Compliance / unit alias existence table (no live DB required)
  • php-src-strict; no php-compiler-strict shortcut

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

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

    Pre-claim gates (this host):

    • php script/bootstrap-inventory.php --check → OK 6392/6392
    • ./script/release-readiness.sh --json still running at claim time
    • Implementing pgsql legacy PHP_FALIAS registrations in ext/pgsql/Module.php (php-src-strict; no new C)
  3. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    Merged via #22259

    Verification

    • php bin/vm.php test/repro/issue_22219_pgsql_legacy_aliases.php → all 25 aliases Y (exit 0)
    • php bin/compile.php -l on same repro → exit 0
    • vendor/bin/phpunit --filter pgsql_legacy_aliases → OK (2 tests, VM+JIT)
    • Inventory --check OK 6392/6392

    Implementation

    • ext/pgsql/Module.php registers PHP_FALIAS second names on existing Internals (php-src pgsql.stub.php @alias / Deprecated aliases)
    • Note: pg_result aliases pg_fetch_result (not pg_result_status)
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