File tree Expand file tree Collapse file tree 3 files changed +50
-7
lines changed Expand file tree Collapse file tree 3 files changed +50
-7
lines changed Original file line number Diff line number Diff line change 2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? 2015, PHP 5.5.25
4
4
5
+ - Core:
6
+ . Fixed bug #68652 (segmentation fault in destructor). (Dmitry)
7
+
5
8
- cURL:
6
9
. Fixed bug #68739 (Missing break / control flow). (Laruence)
7
10
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #68652 (segmentation fault in destructor)
3
+ --FILE--
4
+ <?php
5
+ class Foo {
6
+
7
+ private static $ instance ;
8
+ public static function getInstance () {
9
+ if (isset (self ::$ instance )) {
10
+ return self ::$ instance ;
11
+ }
12
+ return self ::$ instance = new self ();
13
+ }
14
+
15
+ public function __destruct () {
16
+ Bar::getInstance ();
17
+ }
18
+ }
19
+
20
+ class Bar {
21
+
22
+ private static $ instance ;
23
+ public static function getInstance () {
24
+ if (isset (self ::$ instance )) {
25
+ return self ::$ instance ;
26
+ }
27
+ return self ::$ instance = new self ();
28
+ }
29
+
30
+ public function __destruct () {
31
+ Foo::getInstance ();
32
+ }
33
+ }
34
+
35
+
36
+ $ foo = new Foo ();
37
+ ?>
38
+ --EXPECTF--
39
+ Fatal error: Access to undeclared static property: Bar::$instance in %sbug68652.php on line %d
40
+
Original file line number Diff line number Diff line change @@ -162,16 +162,16 @@ static inline void cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
162
162
zend_hash_apply (& ce -> function_table , (apply_func_t ) zend_cleanup_function_data_full TSRMLS_CC );
163
163
}
164
164
if (ce -> static_members_table ) {
165
+ zval * static_members = ce -> static_members_table ;
166
+ int count = ce -> default_static_members_count ;
165
167
int i ;
166
168
167
- for (i = 0 ; i < ce -> default_static_members_count ; i ++ ) {
168
- if (ce -> static_members_table [i ]) {
169
- zval * p = ce -> static_members_table [i ];
170
- ce -> static_members_table [i ] = NULL ;
171
- zval_ptr_dtor (& p );
172
- }
169
+ ce -> default_static_members_count = 0 ;
170
+ ce -> default_static_members_table = ce -> static_members_table = NULL ;
171
+ for (i = 0 ; i < count ; i ++ ) {
172
+ zval_ptr_dtor (& static_members [i ]);
173
173
}
174
- ce -> static_members_table = NULL ;
174
+ efree ( static_members ) ;
175
175
}
176
176
}
177
177
You can’t perform that action at this time.
0 commit comments