Skip to content

Language: Generator return type void accepted — must fatal at compile time (Zend/zend_compile.c) #11666

Closed

Description

@PurHur

Summary

Functions that yield with a declared : void return type compile and run on VM; Zend/php-src rejects them at compile time with Generator return type must be a supertype of Generator, void given.

php-src reference

Repro

test/repro/maintainer_gap_generator_void_return.php

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/maintainer_gap_generator_void_return.php
php bin/vm.php test/repro/maintainer_gap_generator_void_return.php'

Zend: compile-time fatal (exit 255)

VM: prints 1 (exit 0)

Expected (php-src-strict)

Compile-time fatal — generators cannot declare void return type.

Implementation hints

  • Fix in lib/ compile-time return-type validation for generator functions (PHP lowering)
  • No new C runtime branches

Done when

  • Repro fails at compile time on VM/JIT/AOT consistent with Zend
  • Targeted compliance guard under test/compliance/ or test/repro/

Activity

  1. added
    enhancementNew feature or request
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 25, 2026
  2. PurHur commented on Jun 25, 2026

    @PurHur
    OwnerAuthor

    claim: worker-lane-c — batch (issues #11666)

  3. PurHur commented on Jun 25, 2026

    @PurHur
    OwnerAuthor

    Merged via #11670.

    Verification: repro + GeneratorNeverReturnCompileTest + generator_void_return_compile.phpt — Zend and VM both exit 255 with Generator return type must be a supertype of Generator, void given.

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-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions