Skip to content

define() with a runtime value used as an expression leaves the constant undefined #507

Closed

Description

@blacktrs

Summary

define() with a runtime value used as an expression leaves the constant undefined.

Repro

<?php
$v = (int)($argc ?? 1) + 41;
var_dump(define("X", $v));
echo X, "\n";

Expected (php)

bool(true)
42

Actual (manticore 56cd802a, Darwin arm64)

bool(true)
[exit code 255]
PHP Fatal error:  Uncaught Error: Undefined constant "X"

Tracking

Known-bug repro: tests/aot/repro/wrong/define_runtime_value_in_expression.php — bash tests/aot/xfail.sh -k define_runtime_value_in_expression reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 27, 2026
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

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions