File tree Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Original file line number Diff line number Diff line change 3
3
?? ??? 2012, PHP 5.3.20
4
4
5
5
- Zend Engine:
6
+ . Fixed bug #63635 (Segfault in gc_collect_cycles). (Dmitry)
6
7
. Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes
7
8
from value). (Pierrick)
8
9
. Fixed bug #63468 (wrong called method as callback with inheritance).
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #63635 (Segfault in gc_collect_cycles)
3
+ --FILE--
4
+ <?php
5
+ class Node {
6
+ public $ parent = NULL ;
7
+ public $ childs = array ();
8
+
9
+ function __construct (Node $ parent =NULL ) {
10
+ if ($ parent ) {
11
+ $ parent ->childs [] = $ this ;
12
+ }
13
+ $ this ->childs [] = $ this ;
14
+ }
15
+
16
+ function __destruct () {
17
+ $ this ->childs = NULL ;
18
+ }
19
+ }
20
+
21
+ define ("MAX " , 16 );
22
+
23
+ for ($ n = 0 ; $ n < 20 ; $ n ++) {
24
+ $ top = new Node ();
25
+ for ($ i =0 ; $ i <MAX ; $ i ++) {
26
+ $ ci = new Node ($ top );
27
+ for ($ j =0 ; $ j <MAX ; $ j ++) {
28
+ $ cj = new Node ($ ci );
29
+ for ($ k =0 ; $ k <MAX ; $ k ++) {
30
+ $ ck = new Node ($ cj );
31
+ }
32
+ }
33
+ }
34
+ echo "$ n \n" ;
35
+ }
36
+ echo "ok \n" ;
37
+ --EXPECT --
38
+ 0
39
+ 1
40
+ 2
41
+ 3
42
+ 4
43
+ 5
44
+ 6
45
+ 7
46
+ 8
47
+ 9
48
+ 10
49
+ 11
50
+ 12
51
+ 13
52
+ 14
53
+ 15
54
+ 16
55
+ 17
56
+ 18
57
+ 19
58
+ ok
Original file line number Diff line number Diff line change @@ -553,7 +553,8 @@ static void zval_collect_white(zval *pz TSRMLS_DC)
553
553
struct _store_object * obj = & EG (objects_store ).object_buckets [Z_OBJ_HANDLE_P (pz )].bucket .obj ;
554
554
555
555
if (obj -> buffered == (gc_root_buffer * )GC_WHITE ) {
556
- GC_SET_BLACK (obj -> buffered );
556
+ /* PURPLE instead of BLACK to prevent buffering in nested gc calls */
557
+ GC_SET_PURPLE (obj -> buffered );
557
558
558
559
if (EXPECTED (EG (objects_store ).object_buckets [Z_OBJ_HANDLE_P (pz )].valid &&
559
560
Z_OBJ_HANDLER_P (pz , get_properties ) != NULL )) {
@@ -598,7 +599,8 @@ static void zobj_collect_white(zval *pz TSRMLS_DC)
598
599
struct _store_object * obj = & EG (objects_store ).object_buckets [Z_OBJ_HANDLE_P (pz )].bucket .obj ;
599
600
600
601
if (obj -> buffered == (gc_root_buffer * )GC_WHITE ) {
601
- GC_SET_BLACK (obj -> buffered );
602
+ /* PURPLE instead of BLACK to prevent buffering in nested gc calls */
603
+ GC_SET_PURPLE (obj -> buffered );
602
604
603
605
if (EXPECTED (EG (objects_store ).object_buckets [Z_OBJ_HANDLE_P (pz )].valid &&
604
606
Z_OBJ_HANDLER_P (pz , get_properties ) != NULL )) {
You can’t perform that action at this time.
0 commit comments