Skip to content

Regression: prev() string-concat nested operand — returns false not element (re-#13811, ext/standard/array.c) #13903

Closed

Description

@PurHur

Category

stdlib · php-src-strict · regression (re-open of #13811)

Problem

#13811 was closed but prev() in string concatenation still fails on VM (2026-06-30). After next($array), prev($array) must return the previous element value (e.g. int 1). When used as a nested operand inside string concatenation with var_export(..., true), the VM returns false instead of the element.

Standalone prev($array) works; dot-concat form fails.

php-src reference

Repro (verified 2026-06-30)

test/repro/maintainer_gap_prev_concat_operand.php

php bin/vm.php test/repro/maintainer_gap_prev_concat_operand.php
Check Zend VM
next($a); 'prev='.var_export(prev($a), true) prev=1 prev=false
Standalone prev($a) 1 1

Scope (PHP-in-PHP first)

Layer Path
VM ext/standard/prev.php, ext/standard/VmArrayPointer.php
Compiler nested-call / concat operand lowering
JIT ext/standard/JitArrayPointer.php after VM green

Done when (php-src-strict)

  • Repro exits 0 on VM
  • prev() returns correct element in concat contexts
  • JIT/AOT agree when in scope

Verification

php bin/vm.php test/repro/maintainer_gap_prev_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

    claim released: worker-lane-b — scoped to compiler root cause #13916 first

  3. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-b — batch (issues #13903, #13912 via compiler #13916 family)

  4. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Merged guard via #13922. Compiler root cause fixed on master (#13912 statementLevelFuncCallBeforeHoistedSiblingChain). Verification: php bin/vm.php test/repro/maintainer_gap_prev_concat_operand.php → ok; phpunit --filter testVarExportNestedPrevUsesFuncCallProducerSlot green.

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