Skip to content

String interpolation with array access emits corrupted output #340

@nahime0

Description

@nahime0

Description

Double-quoted string interpolation with array access does not match PHP. The compiler accepts the source, but the generated binary emits corrupted literal-looking output instead of the interpolated value.

Minimal reproduction

<?php
$a = ['x' => 'ok'];
echo "{$a['x']}";

Steps to reproduce

  1. Save as main.php.
  2. Run php main.php.
  3. Compile and run with elephc.

Expected behavior

PHP 8.4 prints:

ok

Actual behavior

The elephc-compiled binary prints:

{{['x']}

Environment

  • elephc 0.23.5
  • PHP 8.4.19
  • macOS arm64
  • reproduced on 2026-06-05

Notes

This looks like interpolation parsing/lowering is preserving fragments of the template syntax instead of evaluating the embedded array access expression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions