Skip to content

Language: pipe operator |> — parse/lower missing below PHP_COMPILER_PROFILE=8.4 (zend_language_parser.y) #18007

Closed

Description

@PurHur

Category

Language · PHP 8.4 forward profile

Problem

PHP 8.4 adds the pipe operator |> for functional chaining. Zend 8.2 (reference Docker image) rejects the syntax; Zend 8.4 accepts and evaluates it. This compiler already lowers pipe on PHP_COMPILER_PROFILE=8.4, but the default/8.2 profile should either reject with the Zend parse error or document the gated behavior — workers need a tracked item for full php-src 8.4 parity including JIT/AOT.

Repro Zend 8.2 VM profile=8.4 (2026-07-11)
'hello' |> strtoupper(...) |> strlen(...) Parse error 5

php-src reference

PHP implementation target

  • lib/Compiler.php — pipe parse + AST lowering behind PHP_COMPILER_PROFILE=8.4
  • lib/JIT/ — pipe chain emission when JIT compiles 8.4 units
  • No new runtime/*.c branches

Repro

./script/docker-exec.sh -- bash -lc 'php test/repro/pipe_operator.php 2>&1 | head -1'
# Zend 8.2: Parse error
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/pipe_operator.php'
# expect 5; verify JIT/AOT same

Done when

  • PHP_COMPILER_PROFILE=8.4: VM/JIT/AOT output matches Zend 8.4 for pipe chains (including ... placeholder)
  • Default/8.2 profile: parse error text matches Zend when pipe syntax is used
  • Compliance guard under test/compliance/cases/language/ gated to 8.4
  • php-src-strict on 8.4 reference; profile gate documented

Activity

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

    @PurHur
    OwnerAuthor

    claim: cursor-agent — starting this run

  3. PurHur commented on Jul 11, 2026

    @PurHur
    OwnerAuthor

    Merged via #18022.

    Fix: PipeOperatorSyntaxRejector rejects |> on the 8.4.0-dev reference profile with Zend-shaped syntax error, unexpected token ">" before desugar. VM/JIT/AOT pipe chains remain gated behind PHP_COMPILER_PROFILE=8.4; compliance providers skip forward-only pipe .phpt cases on reference profile.

    Verification (Docker):

    • Reference: php bin/vm.php -r '$x = 5 |> fn ($v) => $v * 2;' → Fatal error: syntax error, unexpected token ">" ...
    • Forward: PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/pipe_operator.php → 5
    • AOT: PHP_COMPILER_PROFILE=8.4 vendor/bin/phpunit test/aot/AotTest.php --filter pipe_operator → OK
    • make bootstrap-selfhost-vm-driver-execute-probe → OK
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:compilerCompiler / CFG / JITenhancementNew 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