xref: /PHP-8.1/Zend/tests/bug69832.phpt (revision f8d79582)
1--TEST--
2Bug #69832 (Assertion failed in zend_compile_const_expr_magic_const)
3--FILE--
4<?php
5
6class Test {
7    public $foo = [Bar::A, __CLASS__][__CLASS__ != ""];
8    public $bar = Bar::A && __CLASS__;
9    public $baz = Bar::A ?: __CLASS__;
10    public $buzz = Bar::A ? __CLASS__ : 0;
11}
12
13eval(<<<'PHP'
14class Bar {
15    const A = 1;
16}
17PHP
18);
19
20$t = new Test;
21var_dump($t->foo);
22var_dump($t->bar);
23var_dump($t->baz);
24var_dump($t->buzz);
25
26?>
27--EXPECT--
28string(4) "Test"
29bool(true)
30int(1)
31string(4) "Test"
32