Skip to content

defined('Class::CONST') and constant('Class::CONST') do not see class constants (symfony's Kernel::preBoot builds such names) #203

Closed

Description

@blacktrs

Summary

defined('Class::CONST') and constant('Class::CONST') do not see class constants (symfony's Kernel::preBoot builds such names).

Repro

<?php
class Cfg { public const LIMIT = 5; }
var_dump(defined('Cfg::LIMIT'));
var_dump(defined('Cfg::NOPE'));
var_dump(constant('Cfg::LIMIT'));
$name = 'Cfg' . '::' . 'LIMIT';
var_dump(\defined($name) ? \constant($name) : 'missing');

Expected (php)

bool(true)
bool(false)
int(5)
int(5)

Actual (manticore bd956725, Darwin arm64)

bool(false)
bool(false)
NULL
string(7) "missing"

Tracking

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

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