Skip to content

Regression: next() string-concat nested operand — returns false not element (re-#13830, ext/standard/array.c) #13912

Closed

Description

@PurHur

Category

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

Problem

After advancing an array internal pointer with next(), a second next($a) as a nested operand inside string concatenation with var_export(..., true) returns false instead of the element value. Standalone next($a) returns the correct value.

Same failure class as #13903 (prev() concat, re-#13811) and #13899 (Generator::current() concat). #13830 was closed 2026-06-30 but repro still fails on master.

php-src reference

Repro (verified 2026-06-30)

test/repro/maintainer_gap_next_concat_operand.php

./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_next_concat_operand.php
Check Zend VM
$a=[1,2,3]; next($a); 'next='.var_export(next($a), true) next=3 next=false
Standalone next($a) after one next 2 correct

Scope (PHP-in-PHP first)

Layer Path
VM Pointer-builtin return binding in concat/nested-call contexts
Compiler Operand lowering if mis-binding by-ref / return slot
JIT after VM green

Done when (php-src-strict)

  • Repro exits 0 on VM
  • next()/prev()/current()/end()/reset() agree in concat and standalone contexts
  • JIT/AOT agree when in scope

Verification

./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_next_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 30, 2026
  2. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Root cause fixed in #13916 / #13917 (compiler firstSiblingInlineFuncCallProducerIndex). Repro test/repro/maintainer_gap_next_concat_operand.php exits 0 on master after merge.

  3. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Verified on master (2026-06-30): php bin/vm.php test/repro/maintainer_gap_next_concat_operand.php → ok; testVarExportNestedNextUsesFuncCallProducerSlot green. Compiler fix via statementLevelFuncCallBeforeHoistedSiblingChain. Closing candidate — sibling #13903 guard merged #13922.

  4. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Verified on master 2026-06-30: php bin/vm.php test/repro/maintainer_gap_next_concat_operand.php → ok (exit 0). Fixed via #13916/#13917 compiler sibling-call producer slot. Closing.

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