Backported from PHP 7 for PHP 5 by Remi, from: From 0c78fe4bb55a9d39afc79cbcbadb9a273f2ec2ef Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 18 Nov 2016 13:19:30 +0300 Subject: [PATCH] Disabled PHP call tracing by default (it makes significant overhead). This may be enabled again using envirionment variable USE_ZEND_DTRACE=1. --- NEWS | 5 +++++ Zend/zend.c | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index d036152..87cdead 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -682,9 +682,19 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) / #if HAVE_DTRACE /* build with dtrace support */ - zend_compile_file = dtrace_compile_file; - zend_execute_ex = dtrace_execute_ex; - zend_execute_internal = dtrace_execute_internal; + { + char *tmp = getenv("USE_ZEND_DTRACE"); + + if (tmp && zend_atoi(tmp, 0)) { + zend_compile_file = dtrace_compile_file; + zend_execute_ex = dtrace_execute_ex; + zend_execute_internal = dtrace_execute_internal; + } else { + zend_compile_file = compile_file; + zend_execute_ex = execute_ex; + zend_execute_internal = NULL; + } + } #else zend_compile_file = compile_file; zend_execute_ex = execute_ex; -- 2.1.4 From f81b7df618750977b9d17f3443d2cb0d74529f50 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 20 Jan 2017 17:45:15 +0100 Subject: [PATCH] Fixed bug #73965 DTrace reported as enabled when disabled --- Zend/zend.c | 2 ++ Zend/zend.h | 2 ++ ext/standard/info.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Zend/zend.c b/Zend/zend.c index 2a47e92..22a92a6 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -122,6 +122,7 @@ #endif ZEND_API zend_utility_values zend_uv; +ZEND_API zend_bool zend_dtrace_enabled; ZEND_API zval zval_used_for_init; /* True global variable */ @@ -686,6 +687,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) / char *tmp = getenv("USE_ZEND_DTRACE"); if (tmp && zend_atoi(tmp, 0)) { + zend_dtrace_enabled = 1; zend_compile_file = dtrace_compile_file; zend_execute_ex = dtrace_execute_ex; zend_execute_internal = dtrace_execute_internal; diff --git a/Zend/zend.h b/Zend/zend.h index 141573f..bb9866d 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -718,6 +718,8 @@ extern ZEND_API zend_class_entry *zend_standard_class_def; extern ZEND_API zend_utility_values zend_uv; extern ZEND_API zval zval_used_for_init; +/* If DTrace is available and enabled */ +extern ZEND_API zend_bool zend_dtrace_enabled; END_EXTERN_C() #define ZEND_UV(name) (zend_uv.name) diff --git a/ext/standard/info.c b/ext/standard/info.c index fa19179..6b06f02 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -1019,7 +1019,7 @@ PHPAPI void php_print_info(int flag) #endif #if HAVE_DTRACE - php_info_print_table_row(2, "DTrace Support", "enabled" ); + php_info_print_table_row(2, "DTrace Support", (zend_dtrace_enabled ? "enabled" : "available, disabled")); #else php_info_print_table_row(2, "DTrace Support", "disabled" ); #endif -- 2.1.4