xref: /PHP-8.3/Zend/tests/bug30702.phpt (revision f8d79582)
1--TEST--
2Bug #30702 (cannot initialize class variable from class constant)
3--FILE--
4<?php
5class foo {
6    const C1=1;
7}
8
9class bar extends foo {
10  const C2=2;
11
12  public $c1=bar::C1;
13  public $c2=bar::C2;
14
15  public $c3=self::C1;
16  public $c4=self::C2;
17
18  public $c5=foo::C1;
19  public $c6=parent::C1;
20}
21
22$x= new bar();
23var_dump($x);
24?>
25--EXPECT--
26object(bar)#1 (6) {
27  ["c1"]=>
28  int(1)
29  ["c2"]=>
30  int(2)
31  ["c3"]=>
32  int(1)
33  ["c4"]=>
34  int(2)
35  ["c5"]=>
36  int(1)
37  ["c6"]=>
38  int(1)
39}
40