Skip to content

Regression: AOT asort()/ksort() compile fails — Module verify arity (ext/standard/array.c) #27513

Description

@PurHur

Category

bug · php-src-strict · stdlib · user-script AOT · pillar 4

Problem

asort / ksort match Zend on VM and JIT, but thin AOT fails module verification with incorrect call arity. Sibling of #27227 (krsort/arsort same Module.php:180 failure).

Probed 2026-08-03 @ 3cf38597b.

Repro Zend / VM / JIT AOT (2026-08-03)
$a=['b'=>2,'a'=>1,'c'=>3]; asort($a); echo keys|values a,b,c|1,2,3 BUILD FAIL Module verification failed due to Incorrect number of arguments passed to called function!
$a=…; ksort($a); … a,b,c|1,2,3 same BUILD FAIL

Null-array probes also fail at compile with the same verify error (cannot reach TypeError path until build is fixed).

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc '
cat > /tmp/aot_asort.php <<'"'"'PHP'"'"'
<?php
$a = ["b" => 2, "a" => 1, "c" => 3];
asort($a);
echo implode(",", array_keys($a)), "|", implode(",", array_values($a)), "\n";
PHP
php bin/vm.php /tmp/aot_asort.php
php bin/jit.php /tmp/aot_asort.php
php bin/compile.php -o /tmp/aot_asort /tmp/aot_asort.php
/tmp/aot_asort
'

Done when

  • phpc build / bin/compile.php succeeds for asort and ksort key/value echo repros
  • Native binary stdout matches Zend / VM / JIT
  • Compliance or test/repro/ guard
  • php-src-strict; no php-compiler-strict shortcut

Refs #27227, #10533

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