File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed
Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Bug #69676: Resolution of self::FOO in class constants not correct
3+ --FILE--
4+ <?php
5+ class A {
6+ const myConst = "const in A " ;
7+ const myDynConst = self ::myConst;
8+ }
9+
10+ class B extends A {
11+ const myConst = "const in B " ;
12+ }
13+
14+ var_dump (B::myDynConst);
15+ var_dump (A::myDynConst);
16+ ?>
17+ --EXPECT--
18+ string(10) "const in A"
19+ string(10) "const in A"
Original file line number Diff line number Diff line change @@ -1325,14 +1325,10 @@ static inline zend_bool zend_is_scope_known() /* {{{ */
13251325 return 0 ;
13261326 }
13271327
1328- if (!CG (active_op_array )-> function_name ) {
1329- /* A file/eval will be run in the including/eval'ing scope */
1330- return 0 ;
1331- }
1332-
13331328 if (!CG (active_class_entry )) {
1334- /* Not being in a scope is a known scope */
1335- return 1 ;
1329+ /* The scope is known if we're in a free function (no scope), but not if we're in
1330+ * a file/eval (which inherits including/eval'ing scope). */
1331+ return CG (active_op_array )-> function_name != NULL ;
13361332 }
13371333
13381334 /* For traits self etc refers to the using class, not the trait itself */
You can’t perform that action at this time.
0 commit comments