summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-01-22 16:39:19 +0100
committerRemi Collet <remi@remirepo.net>2019-01-22 16:39:19 +0100
commit44ff59b2061baba4e0f32d783f7e7051c48f0e97 (patch)
tree43e497eee01628b7a0c233e26849b395fc5bd187
parente2fc62daa456bf09e9b79f0657bf0e7c018ccf22 (diff)
update to 0.10.0
open https://github.com/DataDog/dd-trace-php/issues/249 missing files open https://github.com/DataDog/dd-trace-php/issues/250 PHP compat
-rw-r--r--PHPINFO7
-rw-r--r--REFLECTION9
-rw-r--r--php-pecl-datadog-trace.spec21
-rw-r--r--request_hooks.c101
-rw-r--r--request_hooks.h9
5 files changed, 135 insertions, 12 deletions
diff --git a/PHPINFO b/PHPINFO
index 148d9e6..b05b0ad 100644
--- a/PHPINFO
+++ b/PHPINFO
@@ -7,4 +7,9 @@ For help, check out the documentation at https://github.com/DataDog/dd-trace-php
(c) Datadog 2018
Datadog tracing support => enabled
-Version => 0.9.1-beta
+Version => 0.10.0-beta
+
+Directive => Local Value => Master Value
+ddtrace.disable => 0 => 0
+ddtrace.request_init_hook => no value => no value
+ddtrace.ignore_missing_overridables => 1 => 1
diff --git a/REFLECTION b/REFLECTION
index eaf6668..61041d4 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,9 +1,12 @@
-Extension [ <persistent> extension #84 ddtrace version 0.9.1-beta ] {
+Extension [ <persistent> extension #84 ddtrace version 0.10.0-beta ] {
- INI {
Entry [ ddtrace.disable <SYSTEM> ]
Current = '0'
}
+ Entry [ ddtrace.request_init_hook <SYSTEM> ]
+ Current = ''
+ }
Entry [ ddtrace.ignore_missing_overridables <SYSTEM> ]
Current = '1'
}
@@ -14,6 +17,10 @@ Extension [ <persistent> extension #84 ddtrace version 0.9.1-beta ] {
}
Function [ <internal:ddtrace> function dd_trace_reset ] {
}
+ Function [ <internal:ddtrace> function dd_trace_noop ] {
+ }
+ Function [ <internal:ddtrace> function dd_untrace ] {
+ }
}
}
diff --git a/php-pecl-datadog-trace.spec b/php-pecl-datadog-trace.spec
index b1b76ac..7b757b1 100644
--- a/php-pecl-datadog-trace.spec
+++ b/php-pecl-datadog-trace.spec
@@ -30,11 +30,13 @@
Summary: APM and distributed tracing for PHP
Name: %{?sub_prefix}php-pecl-datadog-trace
-Version: 0.9.1
+Version: 0.10.0
Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: MIT
URL: http://pecl.php.net/package/%{proj_name}
Source0: http://pecl.php.net/get/%{proj_name}-%{version}.tgz
+Source1: https://raw.githubusercontent.com/DataDog/dd-trace-php/038957d286d6c9b65dd98d1c9a7893b66839bc98/src/ext/request_hooks.h
+Source2: https://raw.githubusercontent.com/DataDog/dd-trace-php/038957d286d6c9b65dd98d1c9a7893b66839bc98/src/ext/request_hooks.c
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel > 5.6
@@ -55,14 +57,6 @@ Provides: %{?scl_prefix}php-pecl-%{safe_name}%{?_isa} = %{version}-%{rele
%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
# Other third party repo stuff
-%if "%{php_version}" > "5.6"
-Obsoletes: php56u-pecl-%{safe_name} <= %{version}
-Obsoletes: php56w-pecl-%{safe_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.0"
-Obsoletes: php70u-pecl-%{safe_name} <= %{version}
-Obsoletes: php70w-pecl-%{safe_name} <= %{version}
-%endif
%if "%{php_version}" > "7.1"
Obsoletes: php71u-pecl-%{safe_name} <= %{version}
Obsoletes: php71w-pecl-%{safe_name} <= %{version}
@@ -93,6 +87,7 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%prep
%setup -q -c
mv %{proj_name}-%{version} NTS
+cp %{SOURCE1} %{SOURCE2} NTS/src/ext/
# Don't install tests
sed -e 's/role="test"/role="src"/' \
@@ -118,8 +113,9 @@ cat << 'EOF' | tee %{ini_name}
; Enable %{pecl_name} extension module
extension=%{pecl_name}.so
-; Configuraton
+; Configuration
;ddtrace.disable = 0
+;ddtrace.request_init_hook = ''
;ddtrace.ignore_missing_overridables = 1
EOF
@@ -232,6 +228,11 @@ fi
%changelog
+* Tue Jan 22 2019 Remi Collet <remi@remirepo.net> - 0.10.0-1
+- update to 0.10.0
+- open https://github.com/DataDog/dd-trace-php/issues/249 missing files
+- open https://github.com/DataDog/dd-trace-php/issues/250 PHP compat
+
* Sat Jan 12 2019 Remi Collet <remi@remirepo.net> - 0.9.1-1
- update to 0.9.1
diff --git a/request_hooks.c b/request_hooks.c
new file mode 100644
index 0000000..c4f5f53
--- /dev/null
+++ b/request_hooks.c
@@ -0,0 +1,101 @@
+#include "request_hooks.h"
+#include "compat_zend_string.h"
+
+#include <Zend/zend.h>
+#include <Zend/zend_compile.h>
+#include <php_main.h>
+
+#if PHP_VERSION_ID < 70000
+int dd_execute_php_file(const char *filename TSRMLS_DC) {
+ int filename_len = strlen(filename);
+ if (filename_len == 0) {
+ return FAILURE;
+ }
+ int dummy = 1;
+ zend_file_handle file_handle;
+ zend_op_array *new_op_array;
+ zval *result = NULL;
+ int ret;
+
+ ret = php_stream_open_for_zend_ex(filename, &file_handle, USE_PATH | STREAM_OPEN_FOR_INCLUDE TSRMLS_CC);
+
+ if (ret == SUCCESS) {
+ if (!file_handle.opened_path) {
+ file_handle.opened_path = estrndup(filename, filename_len);
+ }
+ if (zend_hash_add(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path) + 1,
+ (void *)&dummy, sizeof(int), NULL) == SUCCESS) {
+ new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC);
+ zend_destroy_file_handle(&file_handle TSRMLS_CC);
+ } else {
+ new_op_array = NULL;
+ zend_file_handle_dtor(&file_handle TSRMLS_CC);
+ }
+ if (new_op_array) {
+ EG(return_value_ptr_ptr) = &result;
+ EG(active_op_array) = new_op_array;
+ if (!EG(active_symbol_table)) {
+ zend_rebuild_symbol_table(TSRMLS_C);
+ }
+
+ zend_execute(new_op_array TSRMLS_CC);
+
+ destroy_op_array(new_op_array TSRMLS_CC);
+ efree(new_op_array);
+ if (!EG(exception)) {
+ if (EG(return_value_ptr_ptr)) {
+ zval_ptr_dtor(EG(return_value_ptr_ptr));
+ }
+ }
+
+ return 1;
+ }
+ }
+ return 0;
+}
+#else
+
+int dd_execute_php_file(const char *filename TSRMLS_DC) {
+ int filename_len = strlen(filename);
+ if (filename_len == 0) {
+ return FAILURE;
+ }
+ zval dummy;
+ zend_file_handle file_handle;
+ zend_op_array *new_op_array;
+ zval result;
+ int ret;
+
+ ret = php_stream_open_for_zend_ex(filename, &file_handle, USE_PATH | STREAM_OPEN_FOR_INCLUDE);
+
+ if (ret == SUCCESS) {
+ zend_string *opened_path;
+ if (!file_handle.opened_path) {
+ file_handle.opened_path = zend_string_init(filename, filename_len, 0);
+ }
+ opened_path = zend_string_copy(file_handle.opened_path);
+ ZVAL_NULL(&dummy);
+ if (zend_hash_add(&EG(included_files), opened_path, &dummy)) {
+ new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE);
+ zend_destroy_file_handle(&file_handle);
+ } else {
+ new_op_array = NULL;
+ zend_file_handle_dtor(&file_handle);
+ }
+ zend_string_release(opened_path);
+ if (new_op_array) {
+ ZVAL_UNDEF(&result);
+ zend_execute(new_op_array, &result);
+
+ destroy_op_array(new_op_array);
+ efree(new_op_array);
+ if (!EG(exception)) {
+ zval_ptr_dtor(&result);
+ }
+
+ return 1;
+ }
+ }
+ return 0;
+}
+#endif
diff --git a/request_hooks.h b/request_hooks.h
new file mode 100644
index 0000000..449347b
--- /dev/null
+++ b/request_hooks.h
@@ -0,0 +1,9 @@
+#ifndef REQUEST_HOOKS_H
+#define REQUEST_HOOKS_H
+
+#include <Zend/zend_types.h>
+#include <php.h>
+
+int dd_execute_php_file(const char *filename TSRMLS_DC);
+
+#endif // REQUEST_HOOKS_H