Skip to content

Regression: count()/array_merge()/array_keys()/in_array() null TypeError under PROFILE=8.4 — Zend DEP+coerce (ext/standard) #21771

Closed

Description

@PurHur

Category

Regression · php-src-strict · PHP 8.4 implicit-null deprecations (batch peer #21612 / #21614)

Problem

Under PHP_COMPILER_PROFILE=8.4, several array/iter builtins still throw TypeError on null arguments where php-src 8.4 emits a deprecation and continues with the legacy coerced result (same pattern as array_fill(null) on #21612).

Repro Zend 8.4 (php-src) VM PROFILE=8.4 (2026-07-21)
count(null) E_DEPRECATED + 0 TypeError
array_merge(null) E_DEPRECATED + [] TypeError
array_keys(null) E_DEPRECATED + [] TypeError
in_array('a', null) E_DEPRECATED + false TypeError
array_flip(null) E_DEPRECATED + [] TypeError
array_sum(null) E_DEPRECATED + 0 TypeError
iterator_to_array(null) E_DEPRECATED + [] TypeError
array_map(fn($x)=>$x, null) E_DEPRECATED + [] TypeError

(Verify exact return values against php-src 8.4 when implementing; table reflects the standard 8.4 null-to-internal-parameter deprecation ladder.)

php-src reference

PHP implementation target

  • Reuse shared PROFILE=8.4 null deprecation guards (VmString::coerceStringBuiltinArg pattern for arrays: central helper in lib/ or ext/standard/) instead of per-function TypeError
  • ext/standard/ PHP builtins + JIT stubs must agree

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.4 php bin/vm.php -r "
foreach ([\"count\", \"array_merge\", \"array_keys\"] as \$f) {
  try { \$f(null); echo \"\$f ok\\n\"; } catch (Throwable \$e) { echo \"\$f \".get_class(\$e).\"\\n\"; }
}"'

Done when

  • Each listed builtin: deprecation + Zend-matching result on VM/JIT under PROFILE=8.4
  • Compliance guards under test/compliance/cases/array/ (or split child issues if preferred)
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    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 21, 2026
  2. PurHur commented on Jul 21, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  3. added 2 commits that reference this issue on Jul 21, 2026
  4. PurHur commented on Jul 21, 2026

    @PurHur
    OwnerAuthor

    Merged via #21786. VM+JIT repro green under PHP_COMPILER_PROFILE=8.4; VMTest array_null_soft_forward84 OK.

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 machinebugSomething 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