Skip to content

Regression: Generator::current()/::key() string-concat nested operand — returns true not yielded value (Zend/zend_generators.c) #13899

Closed

Description

@PurHur

Category

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

Problem

After advancing a generator with next(), Generator::current() and Generator::key() must return the yielded value and integer key. When either method is a nested operand inside string concatenation with var_export(..., true), the VM returns true instead of the value/key.

Standalone method calls work; dot-concat form fails. Same failure class as pointer builtins (#13830 next(), closed #13811 prev()).

php-src reference

Repro (verified 2026-06-30)

test/repro/maintainer_gap_generator_current_concat_simple.php
test/repro/maintainer_gap_generator_key_concat.php

php bin/vm.php test/repro/maintainer_gap_generator_current_concat_simple.php
php bin/vm.php test/repro/maintainer_gap_generator_key_concat.php
Check Zend VM
$g->next(); $g->next(); 'val='.var_export($g->current(), true) val=30 val=true
$g->next(); 'key='.var_export($g->key(), true) key=1 key=true
Standalone $g->current() / $g->key() correct correct

Scope (PHP-in-PHP first)

Layer Path
VM Generator object handlers, method dispatch return typing
Compiler nested-call / concat operand lowering if mis-binding return type
JIT after VM green

Done when (php-src-strict)

  • Both repros exit 0 on VM
  • Generator methods return correct types in concat/nested contexts
  • JIT/AOT agree when in scope

Verification

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

    Maintainer run 2026-06-30: added committed repro scripts referenced in this issue body:

    • test/repro/maintainer_gap_generator_current_concat_simple.php — FAIL (val=true, expected val=30)
    • test/repro/maintainer_gap_generator_key_concat.php — PASS on current master (key concat path may differ from current())

    Verified:

    ./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_generator_current_concat_simple.php  # exit 1
    ./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_generator_key_concat.php            # exit 0

    Sibling pointer-builtin concat regressions filed/tracked: #13903 (prev), #13912 (next, re-#13830).

  3. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-a — batch (issues #13899)

  4. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Merged via #13944.

    Status: Repro was already green on master — root fix is #13910 (siblingMethodCallFeedsVarExportConsumer for hoisted MethodCall siblings in var_export concat). This PR adds maintainer repro scripts + PHPUnit guards.

    Verification:

    php bin/vm.php test/repro/maintainer_gap_generator_current_concat_simple.php  # val=30
    php bin/vm.php test/repro/maintainer_gap_generator_key_concat.php             # key=1
    php vendor/bin/phpunit test/unit/InlineCallArgProducerSlotTest.php --filter "GeneratorCurrent|GeneratorKey"  # OK (2)
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