Skip to content

Regression: key() string-concat nested operand — returns true not key (ext/standard/array.c) #13829

Description

@PurHur

Category

stdlib · php-src-strict · regression (nested operand in string concatenation)

Problem

After next($array), key($array) must return the current key (e.g. int 1). When used as a nested operand inside string concatenation with var_export(..., true), the VM returns true instead of the key.

Standalone key($array) works; dot-concat form fails. Same failure class as #13811 (prev()).

php-src reference

Repro (verified 2026-06-29)

test/repro/maintainer_gap_key_concat_operand.php

./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_key_concat_operand.php
Check Zend VM
'key='.var_export(key($a), true) after next($a) on [1,2,3] key=1 key=true
Direct key($a) 1 1

Scope (PHP-in-PHP first)

Layer Path
VM ext/standard/key.php, ext/standard/VmArrayPointer.php
Compiler nested-call / concat operand lowering if mis-binding return type
JIT ext/standard/JitArrayPointer.php after VM green

Done when (php-src-strict)

  • Repro exits 0 on VM
  • key() returns int|string|null in concat contexts
  • JIT/AOT agree when in scope

Verification

php bin/vm.php test/repro/maintainer_gap_key_concat_operand.php

Links

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 Jun 29, 2026
  2. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    claim: worker lane C — batch (issues #13829, #13811) — compiler var_export/array-pointer concat mis-bind (lib/Compiler.php)

  3. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Merged via #13894 — compiler var_export/array-pointer concat mis-bind fixed in lib/Compiler.php. Verification: php bin/vm.php test/repro/maintainer_gap_key_concat_operand.php → ok; compliance array_pointer_var_export_concat.phpt green.

  4. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Maintainer: repro script from issue body is now present under test/repro/ (verified VM fails / Zend passes 2026-06-30).

  5. PurHur commented on Jul 5, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #16269, #16254, #13829) — testVarExportNestedArrayPointerBuiltinUsesFuncCallProducerSlot fails (key=2 not key=1)

  6. PurHur commented on Jul 5, 2026

    @PurHur
    OwnerAuthor

    Merged in #16466.

    Verification:

    ./vendor/bin/phpunit test/unit/VarDumpMultiargBuiltinMisbindTest.php
    php bin/vm.php test/repro/maintainer_gap_var_dump_multiarg_builtin_misbind.php
    php bin/vm.php test/repro/maintainer_gap_var_dump_multiarg_stream.php
    ./vendor/bin/phpunit test/unit/InlineCallArgProducerSlotTest.php --filter VarExportNestedArrayPointer
    ./vendor/bin/phpunit test/compliance/VMTest.php --filter array_pointer_var_export_concat
    
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