File tree Expand file tree Collapse file tree 3 files changed +76
-0
lines changed Expand file tree Collapse file tree 3 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-17151: ZEND_FETCH_OBJ_R may modify RC of op1
3+ --FILE--
4+ <?php
5+
6+ class C {
7+ public function __get ($ name ) {
8+ return $ this ;
9+ }
10+ }
11+
12+ function test () {
13+ $ x = (new C )->bar ;
14+ var_dump ($ x );
15+ }
16+
17+ test ();
18+
19+ ?>
20+ --EXPECTF--
21+ object(C)#%d (0) {
22+ }
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-17151: ZEND_FETCH_OBJ_R may modify RC of op1
3+ --FILE--
4+ <?php
5+
6+ class C {
7+ public static $ prop ;
8+
9+ public function __get ($ name ) {
10+ C::$ prop = null ;
11+ }
12+
13+ public function __destruct () {
14+ echo __METHOD__ , "\n" ;
15+ }
16+ }
17+
18+ function test () {
19+ C::$ prop = new C ();
20+ C::$ prop ->bar ;
21+ }
22+
23+ test ();
24+ echo "Done \n" ;
25+
26+ ?>
27+ --EXPECT--
28+ C::__destruct
29+ Done
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-17151: Method calls may modify RC of ZEND_INIT_METHOD_CALL op1
3+ --FILE--
4+ <?php
5+
6+ class C {
7+ public static $ prop ;
8+
9+ public function storeThis () {
10+ self ::$ prop = $ this ;
11+ }
12+ }
13+
14+ function test () {
15+ $ c = new C ();
16+ $ c ->storeThis ();
17+ $ c = null ;
18+ }
19+
20+ test ();
21+
22+ ?>
23+ ===DONE===
24+ --EXPECT--
25+ ===DONE===
You can’t perform that action at this time.
0 commit comments