Skip to content

Commit c768c1f

Browse files
committed
php#7: zend_hrtime_t dtor_start_time Fixed a variable initialization state violation during a goto operation.
1 parent 5802ace commit c768c1f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎Zend/zend_gc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,8 @@ ZEND_API int zend_gc_collect_cycles(void)
21542154

21552155
#endif
21562156

2157+
zend_hrtime_t dtor_start_time = 0;
2158+
21572159
#ifdef PHP_ASYNC_API
21582160
#define GC_COLLECT_TOTAL_COUNT (context->total_count)
21592161
#define GC_COLLECT_COUNT (context->count)
@@ -2185,6 +2187,7 @@ ZEND_API int zend_gc_collect_cycles(void)
21852187
// so we continue the process from the next element.
21862188
GC_G(async_context).state = GC_ASYNC_STATE_RUNNING;
21872189
GC_G(dtor_idx)++;
2190+
dtor_start_time = zend_hrtime();
21882191
goto continue_calling_destructors;
21892192
} else {
21902193
context->state = GC_ASYNC_STATE_INIT;
@@ -2318,7 +2321,7 @@ ZEND_API int zend_gc_collect_cycles(void)
23182321
}
23192322

23202323
/* Actually call destructors. */
2321-
zend_hrtime_t dtor_start_time = zend_hrtime();
2324+
dtor_start_time = zend_hrtime();
23222325
if (EXPECTED(!EG(active_fiber))) {
23232326
#ifdef PHP_ASYNC_API
23242327
continue_calling_destructors:

0 commit comments

Comments
 (0)