Skip to content

Stdlib: ldap_count_entries() JIT path throws instead of matching php-src result count (ext/ldap/ldap.c) #32172

Description

@PurHur

Category

stdlib · php-src-strict · ext/ldap · JIT/AOT lowering

Problem

ldap_count_entries() works on the VM via VmLdapNative::countEntries(), but compiled JIT/AOT calls still throw LogicException from call() in ext/ldap/ldap_search_builtins.php. Compiled PHP therefore cannot walk search results even though the PHP-side runtime already exists.

Repro Zend 8.2+ VM JIT/AOT
ldap_count_entries($ldap, $result) callable callable LogicException today

php-src reference

PHP implementation target

  • ext/ldap/ldap_search_builtins.php — replace the JIT stub in ldap_count_entries::call()
  • ext/ldap/JitLdapResult.php + ext/ldap/LdapResultJitHelper.php — lower LDAP\Connection + LDAP\Result handles through PHP helper code
  • lib/JIT/Builtin/LdapRuntime.php — register the bridge; keep behavior in PHP, no new runtime/*.c logic

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_ENABLE_LDAP=1 php bin/vm.php test/repro/issue_ldap_count_entries_jit.php'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_ENABLE_LDAP=1 php bin/jit.php test/repro/issue_ldap_count_entries_jit.php'

Done when

  • JIT/AOT accept LDAP\Connection + LDAP\Result with php-src-strict TypeErrors on bad args
  • Return is int matching VM/ldap_count_entries() (including -1 when libldap reports error)
  • Targeted repro + unit coverage added
  • No php-compiler-strict shortcut; no new runtime/*.c logic

Activity

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