diff --git a/Zend/Optimizer/zend_func_infos.h b/Zend/Optimizer/zend_func_infos.h index 10f8d950ee0..bb3b52b0454 100644 --- a/Zend/Optimizer/zend_func_infos.h +++ b/Zend/Optimizer/zend_func_infos.h @@ -18,7 +18,7 @@ static const func_info_t func_infos[] = { F1("get_defined_constants", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY), F1("debug_backtrace", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_ARRAY), F1("get_extension_funcs", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_FALSE), - F1("gc_status", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG), + F1("gc_status", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_FALSE|MAY_BE_ARRAY_OF_TRUE), F1("bcadd", MAY_BE_STRING), F1("bcsub", MAY_BE_STRING), F1("bcmul", MAY_BE_STRING), diff --git a/Zend/tests/gc_037.phpt b/Zend/tests/gc_037.phpt index e046944ac1a..64f21c86c4e 100644 --- a/Zend/tests/gc_037.phpt +++ b/Zend/tests/gc_037.phpt @@ -13,23 +13,39 @@ gc_collect_cycles(); var_dump(gc_status()); ?> --EXPECT-- -array(4) { +array(8) { + ["running"]=> + bool(false) + ["protected"]=> + bool(false) + ["full"]=> + bool(false) ["runs"]=> int(0) ["collected"]=> int(0) ["threshold"]=> int(10001) + ["buffer_size"]=> + int(16384) ["roots"]=> int(1) } -array(4) { +array(8) { + ["running"]=> + bool(false) + ["protected"]=> + bool(false) + ["full"]=> + bool(false) ["runs"]=> int(1) ["collected"]=> int(1) ["threshold"]=> int(10001) + ["buffer_size"]=> + int(16384) ["roots"]=> int(0) } diff --git a/Zend/tests/gc_045.phpt b/Zend/tests/gc_045.phpt index 865462ecfbc..3789b97aeb6 100644 --- a/Zend/tests/gc_045.phpt +++ b/Zend/tests/gc_045.phpt @@ -46,13 +46,21 @@ for ($j = 0; $j < 10; $j++) { var_dump(gc_status()); ?> --EXPECT-- -array(4) { +array(8) { + ["running"]=> + bool(false) + ["protected"]=> + bool(false) + ["full"]=> + bool(false) ["runs"]=> int(10) ["collected"]=> int(25000) ["threshold"]=> int(10001) + ["buffer_size"]=> + int(16384) ["roots"]=> int(10000) } diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index a762240abe3..7958f44a4d9 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -140,9 +140,13 @@ ZEND_FUNCTION(gc_status) array_init_size(return_value, 3); + add_assoc_bool_ex(return_value, "running", sizeof("running")-1, status.active); + add_assoc_bool_ex(return_value, "protected", sizeof("protected")-1, status.gc_protected); + add_assoc_bool_ex(return_value, "full", sizeof("full")-1, status.full); add_assoc_long_ex(return_value, "runs", sizeof("runs")-1, (long)status.runs); add_assoc_long_ex(return_value, "collected", sizeof("collected")-1, (long)status.collected); add_assoc_long_ex(return_value, "threshold", sizeof("threshold")-1, (long)status.threshold); + add_assoc_long_ex(return_value, "buffer_size", sizeof("buffer_size")-1, (long)status.buf_size); add_assoc_long_ex(return_value, "roots", sizeof("roots")-1, (long)status.num_roots); } /* }}} */ diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php index ca04719742c..94d356e7908 100644 --- a/Zend/zend_builtin_functions.stub.php +++ b/Zend/zend_builtin_functions.stub.php @@ -194,7 +194,7 @@ function gc_enable(): void {} function gc_disable(): void {} /** - * @return array + * @return array * @refcount 1 */ function gc_status(): array {} diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h index 83808441887..c39f847871b 100644 --- a/Zend/zend_builtin_functions_arginfo.h +++ b/Zend/zend_builtin_functions_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 80355bb52d643177e3a661a515d9ea915bd1e2fc */ + * Stub hash: 73e9ef76bde5ab44254185175d4d8dae2e797d12 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 766e1ffea9a..66324672b1e 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -1675,9 +1675,13 @@ finish: ZEND_API void zend_gc_get_status(zend_gc_status *status) { + status->active = GC_G(gc_active); + status->gc_protected = GC_G(gc_protected); + status->full = GC_G(gc_full); status->runs = GC_G(gc_runs); status->collected = GC_G(collected); status->threshold = GC_G(gc_threshold); + status->buf_size = GC_G(buf_size); status->num_roots = GC_G(num_roots); } diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h index 3221335733e..0589e193f4a 100644 --- a/Zend/zend_gc.h +++ b/Zend/zend_gc.h @@ -23,9 +23,13 @@ BEGIN_EXTERN_C() typedef struct _zend_gc_status { + bool active; + bool gc_protected; + bool full; uint32_t runs; uint32_t collected; uint32_t threshold; + uint32_t buf_size; uint32_t num_roots; } zend_gc_status;