File tree Expand file tree Collapse file tree 3 files changed +45
-4
lines changed
Expand file tree Collapse file tree 3 files changed +45
-4
lines changed Original file line number Diff line number Diff line change 55- Core:
66 . Fixed GH-13569 (GC buffer unnecessarily grows up to GC_MAX_BUF_SIZE when
77 scanning WeakMaps). (Arnaud)
8+ . Fixed bug GH-13612 (Corrupted memory in destructor with weak references).
9+ (nielsdos)
810
911- Gettext:
1012 . Fixed sigabrt raised with dcgettext/dcngettext calls with gettext 0.22.5
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-13612 (Corrupted memory in destructor with weak references)
3+ --FILE--
4+ <?php
5+
6+ class WeakAnalysingMapRepro
7+ {
8+ public array $ destroyed = [];
9+ public array $ ownerDestructorHandlers = [];
10+
11+ public function __construct ()
12+ {
13+ $ handler = new class ($ this ) {
14+ private \WeakReference $ weakAnalysingMap ;
15+
16+ public function __construct (WeakAnalysingMapRepro $ analysingMap )
17+ {
18+ $ this ->weakAnalysingMap = \WeakReference::create ($ analysingMap );
19+ }
20+
21+ public function __destruct ()
22+ {
23+ var_dump ($ this ->weakAnalysingMap ->get ());
24+ }
25+ };
26+
27+ $ this ->destroyed [] = 1 ;
28+ $ this ->ownerDestructorHandlers [] = $ handler ;
29+ }
30+ }
31+
32+ new WeakAnalysingMapRepro ();
33+
34+ echo "Done \n" ;
35+
36+ ?>
37+ --EXPECT--
38+ NULL
39+ Done
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ ZEND_API void zend_object_std_dtor(zend_object *object)
5050{
5151 zval * p , * end ;
5252
53+ if (UNEXPECTED (GC_FLAGS (object ) & IS_OBJ_WEAKLY_REFERENCED )) {
54+ zend_weakrefs_notify (object );
55+ }
56+
5357 if (object -> properties ) {
5458 if (EXPECTED (!(GC_FLAGS (object -> properties ) & IS_ARRAY_IMMUTABLE ))) {
5559 if (EXPECTED (GC_DELREF (object -> properties ) == 0 )
@@ -88,10 +92,6 @@ ZEND_API void zend_object_std_dtor(zend_object *object)
8892 FREE_HASHTABLE (guards );
8993 }
9094 }
91-
92- if (UNEXPECTED (GC_FLAGS (object ) & IS_OBJ_WEAKLY_REFERENCED )) {
93- zend_weakrefs_notify (object );
94- }
9595}
9696
9797ZEND_API void zend_objects_destroy_object (zend_object * object )
You can’t perform that action at this time.
0 commit comments