diff options
author | Remi Collet <remi@remirepo.net> | 2020-07-09 08:48:18 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-07-09 08:48:18 +0200 |
commit | 33968e12fc2c455056f41a5748117c7b37c77217 (patch) | |
tree | 517a73208c8529a061d2889905c08dd269613333 | |
parent | 6aa9fbd1a0f28dbb18f8a2cd045e38f4c6c9e8b6 (diff) |
update to 0.47.0
open https://github.com/DataDog/dd-trace-php/pull/952
improve CGI usage in test suite
open https://github.com/DataDog/dd-trace-php/issues/953
missing files in 0.47.0 archive
-rw-r--r-- | 952.patch | 51 | ||||
-rw-r--r-- | PHPINFO | 10 | ||||
-rw-r--r-- | REFLECTION | 54 | ||||
-rw-r--r-- | engine_api.c | 39 | ||||
-rw-r--r-- | engine_api.h | 17 | ||||
-rw-r--r-- | handlers_curl.c | 269 | ||||
-rw-r--r-- | handlers_internal.c | 15 | ||||
-rw-r--r-- | php-pecl-datadog-trace.spec | 40 |
8 files changed, 441 insertions, 54 deletions
diff --git a/952.patch b/952.patch new file mode 100644 index 0000000..3cba6f5 --- /dev/null +++ b/952.patch @@ -0,0 +1,51 @@ +From 7720c13ed242e87ce1e934f80378a6f145ebd769 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 9 Jul 2020 07:50:18 +0200 +Subject: [PATCH 1/2] improve CGI usage + +--- + tests/ext/startup_logging.inc | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tests/ext/startup_logging.inc b/tests/ext/startup_logging.inc +index 17235e11e..869e65da5 100644 +--- a/tests/ext/startup_logging.inc ++++ b/tests/ext/startup_logging.inc +@@ -2,8 +2,12 @@ + + function dd_get_php_cgi() + { +- $executable = dirname(getenv('TEST_PHP_EXECUTABLE')) . '/php-cgi'; +- return file_exists($executable) && is_executable($executable) ? $executable : ''; ++ $executable = getenv('TEST_PHP_CGI_EXECUTABLE') ?: getenv('TEST_PHP_EXECUTABLE') . '-cgi'; ++ if (file_exists($executable) && is_executable($executable)) { ++ $args = getenv('TEST_PHP_ARGS'); ++ return $args ? "$executable $args" : "$executable"; ++ } ++ return ''; + } + + function dd_get_startup_logs(array $args = [], array $env = []) + +From 60396869f4ee09a68d532d40a5e72c4c0cfcc102 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 9 Jul 2020 08:09:50 +0200 +Subject: [PATCH 2/2] relax test expectation + +--- + tests/ext/startup_logging_diagnostics.phpt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/ext/startup_logging_diagnostics.phpt b/tests/ext/startup_logging_diagnostics.phpt +index 13c458997..581b6098b 100644 +--- a/tests/ext/startup_logging_diagnostics.phpt ++++ b/tests/ext/startup_logging_diagnostics.phpt +@@ -31,7 +31,7 @@ dd_dump_startup_logs($logs, [ + ]); + ?> + --EXPECTF-- +-agent_error: "Could not resolve host: invalid_host" ++agent_error: %sinvalid_host%s + open_basedir_init_hook_allowed: false + open_basedir_container_tagging_allowed: false + service_name: "foo_service" @@ -4,10 +4,16 @@ ddtrace Datadog PHP tracer extension For help, check out the documentation at https://docs.datadoghq.com/tracing/languages/php/ -(c) Datadog 2019 +(c) Datadog 2020 Datadog tracing support => enabled -Version => 0.46.0 +Version => 0.47.0 +DATADOG TRACER CONFIGURATION => {"date":"2020-07-09T06:04:15Z","os_name":"Linux builder.remirepo.net 5.7.7-100.fc31.x86_64 #1 SMP Wed Jul 1 20:37:05 UTC 2020 x86_64","os_version":"5.7.7-100.fc31.x86_64","version":"0.47.0","lang":"php","lang_version":"7.3.20","env":null,"enabled":true,"service":null,"enabled_cli":false,"agent_url":"http://localhost:8126","debug":false,"analytics_enabled":false,"sample_rate":1.000000,"sampling_rules":null,"tags":null,"service_mapping":null,"distributed_tracing_enabled":true,"priority_sampling_enabled":true,"dd_version":null,"architecture":"x86_64","sapi":"cli","ddtrace.request_init_hook":null,"open_basedir_configured":false,"uri_fragment_regex":null,"uri_mapping_incoming":null,"uri_mapping_outgoing":null,"auto_flush_enabled":false,"generate_root_span":true,"http_client_split_by_domain":false,"measure_compile_time":true,"report_hostname_on_root_span":false,"traced_internal_functions":null,"auto_prepend_file_configured":false,"integrations_disabled":null,"enabled_from_env":true,"opcache.file_cache":null,"agent_error":"Failed to connect to localhost port 8126: Connection refused","ddtrace.request_init_hook_reachable":false} + + Diagnostics +agent_error => Failed to connect to localhost port 8126: Connection refused +ddtrace.request_init_hook_reachable => false +Diagnostic checks => failed Directive => Local Value => Master Value ddtrace.disable => Off => Off @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #114 ddtrace version 0.46.0 ] { +Extension [ <persistent> extension #116 ddtrace version 0.47.0 ] { - INI { Entry [ ddtrace.disable <SYSTEM> ] @@ -13,7 +13,7 @@ Extension [ <persistent> extension #114 ddtrace version 0.46.0 ] { } - Constants [1] { - Constant [ string DD_TRACE_VERSION ] { 0.46.0 } + Constant [ string DD_TRACE_VERSION ] { 0.47.0 } } - Functions { @@ -43,25 +43,10 @@ Extension [ <persistent> extension #114 ddtrace version 0.46.0 ] { } Function [ <internal:ddtrace> function dd_trace_forward_call ] { } - Function [ <internal:ddtrace> function dd_trace_function ] { - - - Parameters [2] { - Parameter #0 [ <required> $function_name ] - Parameter #1 [ <required> $tracing_closure ] - } - } Function [ <internal:ddtrace> function dd_trace_generate_id ] { } Function [ <internal:ddtrace> function dd_trace_internal_fn ] { } - Function [ <internal:ddtrace> function dd_trace_method ] { - - - Parameters [3] { - Parameter #0 [ <required> $class_name ] - Parameter #1 [ <required> $method_name ] - Parameter #2 [ <required> $tracing_closure ] - } - } Function [ <internal:ddtrace> function dd_trace_noop ] { } Function [ <internal:ddtrace> function dd_trace_peek_span_id ] { @@ -146,6 +131,41 @@ Extension [ <persistent> extension #114 ddtrace version 0.46.0 ] { Parameter #0 [ <required> $dir ] } } + Function [ <internal:ddtrace> function DDTrace\trace_function ] { + + - Parameters [2] { + Parameter #0 [ <required> $function_name ] + Parameter #1 [ <required> $tracing_closure ] + } + } + Function [ <internal:ddtrace> function dd_trace_function ] { + + - Parameters [2] { + Parameter #0 [ <required> $function_name ] + Parameter #1 [ <required> $tracing_closure ] + } + } + Function [ <internal:ddtrace> function DDTrace\trace_method ] { + + - Parameters [3] { + Parameter #0 [ <required> $class_name ] + Parameter #1 [ <required> $method_name ] + Parameter #2 [ <required> $tracing_closure ] + } + } + Function [ <internal:ddtrace> function dd_trace_method ] { + + - Parameters [3] { + Parameter #0 [ <required> $class_name ] + Parameter #1 [ <required> $method_name ] + Parameter #2 [ <required> $tracing_closure ] + } + } + Function [ <internal:ddtrace> function DDTrace\startup_logs ] { + + - Parameters [0] { + } + } } - Classes [1] { diff --git a/engine_api.c b/engine_api.c new file mode 100644 index 0000000..05cfe15 --- /dev/null +++ b/engine_api.c @@ -0,0 +1,39 @@ +#include "engine_api.h" + +#include "engine_hooks.h" // for ddtrace_backup_error_handling + +int ddtrace_call_sandboxed_function(const char *name, size_t name_len, zval **retval, int argc, + zval **argv[] TSRMLS_DC) { + zval *fname; + MAKE_STD_ZVAL(fname); + ZVAL_STRINGL(fname, name, name_len, 1); + zend_fcall_info fci; + zend_fcall_info_cache fcc; + + // Play it safe if an exception has not been handled yet + if (EG(exception)) { + return FAILURE; + } + + ddtrace_error_handling eh; + ddtrace_backup_error_handling(&eh, EH_SUPPRESS TSRMLS_CC); + + int result = zend_fcall_info_init(fname, IS_CALLABLE_CHECK_SILENT, &fci, &fcc, NULL, NULL TSRMLS_CC); + if (result == SUCCESS) { + fci.retval_ptr_ptr = retval; + fci.params = argv; + fci.no_separation = 0; // allow for by-ref args + fci.param_count = argc; + result = zend_call_function(&fci, &fcc TSRMLS_CC); + } + + ddtrace_restore_error_handling(&eh TSRMLS_CC); + + if (EG(exception)) { + zend_clear_exception(TSRMLS_C); + } + + zval_dtor(fname); + efree(fname); + return result; +} diff --git a/engine_api.h b/engine_api.h new file mode 100644 index 0000000..e0948ac --- /dev/null +++ b/engine_api.h @@ -0,0 +1,17 @@ +#ifndef DDTRACE_PHP_5_ENGINE_API_H +#define DDTRACE_PHP_5_ENGINE_API_H + +/* This file is for things that make working with the engine easier. Good + * candidates include: + * - Wrappers for functions which change signature/semantics over time. + * - Wrappers that reduce verbosity when working with zend_* functions. + * - Functions that perform high-level language tasks, such as reading and + * writing object properties, calling functions, calling methods, etc. + */ + +#include <php.h> + +int ddtrace_call_sandboxed_function(const char *name, size_t name_len, zval **retval, int argc, + zval **argv[] TSRMLS_DC); + +#endif // DDTRACE_PHP_5_ENGINE_API_H diff --git a/handlers_curl.c b/handlers_curl.c new file mode 100644 index 0000000..54a4ea1 --- /dev/null +++ b/handlers_curl.c @@ -0,0 +1,269 @@ +#include <inttypes.h> +#include <php.h> +#include <stdbool.h> + +#include <ext/standard/php_array.h> + +#include "configuration.h" +#include "ddtrace.h" +#include "distributed_tracing.h" +#include "engine_api.h" +#include "handlers_internal.h" +#include "random.h" + +// True global - only modify during MINIT/MSHUTDOWN +long _dd_const_curlopt_httpheader = 0; + +static void (*_dd_curl_close_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; +static void (*_dd_curl_copy_handle_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; +static void (*_dd_curl_exec_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; +static void (*_dd_curl_init_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; +static void (*_dd_curl_setopt_array_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; +static void (*_dd_curl_setopt_handler)(INTERNAL_FUNCTION_PARAMETERS) = NULL; + +ZEND_EXTERN_MODULE_GLOBALS(ddtrace); + +static bool _dd_load_curl_integration(TSRMLS_D) { + if (!get_dd_trace_sandbox_enabled() || DDTRACE_G(disable_in_current_request)) { + return false; + } + return ddtrace_config_distributed_tracing_enabled(TSRMLS_C) && DDTRACE_G(le_curl); +} + +static void _dd_saved_headers_dtor(void *headers) { + HashTable *ht = *((HashTable **)headers); + zend_hash_destroy(ht); + FREE_HASHTABLE(ht); +} + +static void _dd_store_resource_header_cache(zval *resource, HashTable *headers TSRMLS_DC) { + if (!DDTRACE_G(dt_http_saved_curl_headers)) { + ALLOC_HASHTABLE(DDTRACE_G(dt_http_saved_curl_headers)); + zend_hash_init(DDTRACE_G(dt_http_saved_curl_headers), 8, NULL, (dtor_func_t)_dd_saved_headers_dtor, 0); + } + + HashTable *new_headers; + ALLOC_HASHTABLE(new_headers); + zend_hash_init(new_headers, zend_hash_num_elements(headers), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(new_headers, headers, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval *)); + + zend_hash_index_update(DDTRACE_G(dt_http_saved_curl_headers), Z_RESVAL_P(resource), &new_headers, + sizeof(HashTable *), NULL); +} + +static void _dd_delete_resource_header_cache(zval *resource TSRMLS_DC) { + if (DDTRACE_G(dt_http_saved_curl_headers)) { + zend_hash_index_del(DDTRACE_G(dt_http_saved_curl_headers), Z_RESVAL_P(resource)); + } +} + +static bool _dd_is_valid_curl_resource(zval *ch TSRMLS_DC) { + void *resource = zend_fetch_resource(&ch TSRMLS_CC, -1, "cURL handle", NULL, 1, DDTRACE_G(le_curl)); + return resource != NULL; +} + +ZEND_FUNCTION(ddtrace_curl_close) { + zval *ch; + + if (_dd_load_curl_integration(TSRMLS_C) && + zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &ch) == SUCCESS) { + if (_dd_is_valid_curl_resource(ch TSRMLS_CC)) { + _dd_delete_resource_header_cache(ch TSRMLS_CC); + } + } + + _dd_curl_close_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +static void _dd_copy_dt_http_headers(zval *ch_orig, zval *ch_new TSRMLS_DC) { + HashTable *headers_store = DDTRACE_G(dt_http_saved_curl_headers); + HashTable **users_headers = NULL; + if (headers_store && zend_hash_index_find(headers_store, Z_RESVAL_P(ch_orig), (void **)&users_headers) == SUCCESS) { + _dd_store_resource_header_cache(ch_new, *users_headers TSRMLS_CC); + } +} + +ZEND_FUNCTION(ddtrace_curl_copy_handle) { + zval *ch1; + + if (!_dd_load_curl_integration(TSRMLS_C) || + zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &ch1) == FAILURE) { + _dd_curl_copy_handle_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + return; + } + + _dd_curl_copy_handle_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + + if (Z_TYPE_P(return_value) == IS_RESOURCE) { + _dd_copy_dt_http_headers(ch1, return_value TSRMLS_CC); + } +} + +// Returns the user's headers for this resource +// Caller must free the HashTable +static HashTable *_dd_get_existing_headers(zval *resource TSRMLS_DC) { + HashTable *retval; + ALLOC_HASHTABLE(retval); + + HashTable *headers_store = DDTRACE_G(dt_http_saved_curl_headers); + HashTable **users_headers = NULL; + if (headers_store && + zend_hash_index_find(headers_store, Z_RESVAL_P(resource), (void **)&users_headers) == SUCCESS) { + size_t headers_count = zend_hash_num_elements(*users_headers); + zend_hash_init(retval, headers_count, NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(retval, *users_headers, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval *)); + } else { + zend_hash_init(retval, 0, NULL, ZVAL_PTR_DTOR, 0); + } + return retval; +} + +ZEND_FUNCTION(ddtrace_curl_exec) { + zval *ch; + + if (_dd_load_curl_integration(TSRMLS_C) && ddtrace_peek_span_id(TSRMLS_C) != 0 && + zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &ch) == SUCCESS) { + if (_dd_is_valid_curl_resource(ch TSRMLS_CC) && + zend_hash_exists(EG(function_table), "ddtrace\\bridge\\curl_inject_distributed_headers", + sizeof("ddtrace\\bridge\\curl_inject_distributed_headers") /* no - 1 */)) { + // Inject distributed tracing headers before the curl_exec() call + zval **setopt_args[2]; + + // Arg 0: resource $ch + setopt_args[0] = &ch; + + // Arg 1: mixed $value (array of headers) + HashTable *headers = _dd_get_existing_headers(ch TSRMLS_CC); + zval *headers_zv; + MAKE_STD_ZVAL(headers_zv); + headers_zv->type = IS_ARRAY; + headers_zv->value.ht = headers; + zval_copy_ctor(headers_zv); + setopt_args[1] = &headers_zv; + + zval *retval = NULL; + DDTRACE_G(back_up_http_headers) = 0; // Don't save our own HTTP headers + if (ddtrace_call_sandboxed_function(ZEND_STRL("ddtrace\\bridge\\curl_inject_distributed_headers"), &retval, + 2, setopt_args TSRMLS_CC) == SUCCESS && + retval) { + zval_ptr_dtor(&retval); + } + DDTRACE_G(back_up_http_headers) = 1; + + zval_ptr_dtor(&headers_zv); + zend_hash_destroy(headers); + FREE_HASHTABLE(headers); + } + } + + _dd_curl_exec_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); +} + +ZEND_FUNCTION(ddtrace_curl_init) { + _dd_curl_init_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + + if (Z_TYPE_P(return_value) == IS_RESOURCE) { + if (!DDTRACE_G(le_curl)) { + zend_list_find(Z_LVAL_P(return_value), &DDTRACE_G(le_curl)); + DDTRACE_G(back_up_http_headers) = 1; + } + if (_dd_load_curl_integration(TSRMLS_C)) { + _dd_delete_resource_header_cache(return_value TSRMLS_CC); + } + } +} + +ZEND_FUNCTION(ddtrace_curl_setopt) { + zval *zid, **zvalue; + long option; + + if (!_dd_load_curl_integration(TSRMLS_C) || + zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rlZ", &zid, &option, &zvalue) == + FAILURE) { + _dd_curl_setopt_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + return; + } + + _dd_curl_setopt_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + + if (DDTRACE_G(back_up_http_headers) && Z_BVAL_P(return_value) && _dd_const_curlopt_httpheader == option) { + _dd_store_resource_header_cache(zid, Z_ARRVAL_PP(zvalue) TSRMLS_CC); + } +} + +ZEND_FUNCTION(ddtrace_curl_setopt_array) { + zval *zid, *arr; + + if (!_dd_load_curl_integration(TSRMLS_C) || + zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ra", &zid, &arr) == FAILURE) { + _dd_curl_setopt_array_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + return; + } + + _dd_curl_setopt_array_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + + if (Z_BVAL_P(return_value)) { + zval **value; + if (zend_hash_index_find(Z_ARRVAL_P(arr), _dd_const_curlopt_httpheader, (void **)&value) == SUCCESS) { + _dd_store_resource_header_cache(zid, Z_ARRVAL_PP(value) TSRMLS_CC); + } + } +} + +struct _dd_curl_handler { + const char *name; + size_t name_len; + void (**old_handler)(INTERNAL_FUNCTION_PARAMETERS); + void (*new_handler)(INTERNAL_FUNCTION_PARAMETERS); +}; +typedef struct _dd_curl_handler _dd_curl_handler; + +static void _dd_install_handler(_dd_curl_handler handler TSRMLS_DC) { + zend_function *old_handler; + if (zend_hash_find(CG(function_table), handler.name, handler.name_len, (void **)&old_handler) == SUCCESS && + old_handler != NULL) { + *handler.old_handler = old_handler->internal_function.handler; + old_handler->internal_function.handler = handler.new_handler; + } +} + +void ddtrace_curl_handlers_startup(void) { + TSRMLS_FETCH(); + // If we cannot find ext/curl then do not hook the functions + if (!zend_hash_exists(&module_registry, "curl", sizeof("curl") /* no - 1 */)) { + return; + } + + zval *tmp; + MAKE_STD_ZVAL(tmp); + int res = zend_get_constant_ex(ZEND_STRL("CURLOPT_HTTPHEADER"), tmp, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC); + if (res) { + _dd_const_curlopt_httpheader = Z_LVAL_P(tmp); + } + zval_dtor(tmp); + efree(tmp); + if (!res) { + return; + } + + // These are not 'sizeof() - 1' on PHP 5 + _dd_curl_handler handlers[] = { + {"curl_close", sizeof("curl_close"), &_dd_curl_close_handler, ZEND_FN(ddtrace_curl_close)}, + {"curl_copy_handle", sizeof("curl_copy_handle"), &_dd_curl_copy_handle_handler, + ZEND_FN(ddtrace_curl_copy_handle)}, + {"curl_exec", sizeof("curl_exec"), &_dd_curl_exec_handler, ZEND_FN(ddtrace_curl_exec)}, + {"curl_init", sizeof("curl_init"), &_dd_curl_init_handler, ZEND_FN(ddtrace_curl_init)}, + {"curl_setopt", sizeof("curl_setopt"), &_dd_curl_setopt_handler, ZEND_FN(ddtrace_curl_setopt)}, + {"curl_setopt_array", sizeof("curl_setopt_array"), &_dd_curl_setopt_array_handler, + ZEND_FN(ddtrace_curl_setopt_array)}, + }; + size_t handlers_len = sizeof handlers / sizeof handlers[0]; + for (size_t i = 0; i < handlers_len; ++i) { + _dd_install_handler(handlers[i] TSRMLS_CC); + } +} + +void ddtrace_curl_handlers_rshutdown(void) { + TSRMLS_FETCH(); + DDTRACE_G(le_curl) = 0; +} diff --git a/handlers_internal.c b/handlers_internal.c deleted file mode 100644 index ad09ba1..0000000 --- a/handlers_internal.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "handlers_internal.h" - -#include "compatibility.h" - -void ddtrace_replace_internal_function(const HashTable *ht, ddtrace_string fname) { PHP5_UNUSED(ht, fname); } -void ddtrace_replace_internal_functions(const HashTable *ht, size_t functions_len, ddtrace_string functions[]) { - PHP5_UNUSED(ht, functions_len, functions); -} -void ddtrace_replace_internal_methods(ddtrace_string Class, size_t methods_len, ddtrace_string methods[]) { - PHP5_UNUSED(Class, methods_len, methods); -} - -void ddtrace_internal_handlers_startup(void) {} -void ddtrace_internal_handlers_shutdown(void) {} -void ddtrace_internal_handlers_rshutdown(void) {} diff --git a/php-pecl-datadog-trace.spec b/php-pecl-datadog-trace.spec index 0d1a4c8..2554b3e 100644 --- a/php-pecl-datadog-trace.spec +++ b/php-pecl-datadog-trace.spec @@ -34,7 +34,7 @@ Summary: APM and distributed tracing for PHP Name: %{?sub_prefix}php-pecl-datadog-trace -Version: 0.46.0 +Version: 0.47.0 Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} # extension is dual-licensed under Apache 2.0 or BSD3. # mpack is MIT @@ -42,7 +42,14 @@ License: (ASL 2.0 or BSD) and MIT URL: https://pecl.php.net/package/%{proj_name} Source0: https://pecl.php.net/get/%{proj_name}-%{version}.tgz -Source1: https://raw.githubusercontent.com/DataDog/dd-trace-php/0.46.0/src/ext/php5_4/handlers_internal.c +Source1: https://raw.githubusercontent.com/DataDog/dd-trace-php/0.47.0/src/ext/php5/engine_api.c +Source2: https://raw.githubusercontent.com/DataDog/dd-trace-php/0.47.0/src/ext/php5/engine_api.h +Source3: https://raw.githubusercontent.com/DataDog/dd-trace-php/0.47.0/src/ext/php5/handlers_curl.c + +Patch0: https://patch-diff.githubusercontent.com/raw/DataDog/dd-trace-php/pull/952.patch + +# ddtrace only supports 64-bit platforms +ExcludeArch: %{ix86} %{arm} %if 0%{?rhel} == 6 BuildRequires: devtoolset-6-toolchain @@ -57,8 +64,8 @@ BuildRequires: %{?scl_prefix}php-curl BuildRequires: %{?scl_prefix}php-json BuildRequires: %{?scl_prefix}php-posix #BuildRequires: gdb -#BuildRequires: %{?scl_prefix}php-debuginfo -#BuildRequires: %{?scl_prefix}php-debugsource +#BuildRequires: %%{?scl_prefix}php-debuginfo +#BuildRequires: %%{?scl_prefix}php-debugsource Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} @@ -112,7 +119,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -cp %{SOURCE1} src/ext/php5_4/handlers_internal.c +%patch0 -p1 +cp %{SOURCE1} %{SOURCE2} %{SOURCE3} src/ext/php5/ cp src/ext/mpack/LICENSE LICENSE.mpack : Sanity check, really often broken extver=$(sed -n '/#define PHP_DDTRACE_VERSION /{s/.* "//;s/".*$//;p}' src/ext/version.h) @@ -192,21 +200,6 @@ done # Erratic results rm ?TS/tests/ext/segfault_backtrace_*.phpt rm ?TS/tests/ext/sandbox/memory_limit_graceful_bailout.phpt -%if %{__isa_bits} < 64 -# see https://github.com/DataDog/dd-trace-php/issues/394 -rm ?TS/tests/ext/circuit_breaker_info.phpt -rm ?TS/tests/ext/sandbox/dd_trace_function_complex.phpt -rm ?TS/tests/ext/sandbox/dd_trace_function_internal.phpt -rm ?TS/tests/ext/sandbox/dd_trace_function_userland.phpt -rm ?TS/tests/ext/sandbox/dd_trace_method.phpt -rm ?TS/tests/ext/sandbox/dd_trace_method_works_with_dd_trace.phpt -rm ?TS/tests/ext/sandbox/errors_are_flagged_from_userland.phpt -rm ?TS/tests/ext/sandbox/exceptions_and_errors_are_ignored_in_tracing_closure.phpt -rm ?TS/tests/ext/sandbox/dd_trace_set_trace_id.phpt -rm ?TS/tests/ext/sandbox-prehook/dd_trace_method.phpt -rm ?TS/tests/ext/sandbox-prehook/dd_trace_method_works_with_dd_trace.phpt -%endif - MOD="-n" [ -f %{php_extdir}/curl.so ] && MOD="$MOD -d extension=curl.so" @@ -275,6 +268,13 @@ fi %changelog +* Thu Jul 9 2020 Remi Collet <remi@remirepo.net> - 0.47.0-1 +- update to 0.47.0 +- open https://github.com/DataDog/dd-trace-php/pull/952 + improve CGI usage in test suite +- open https://github.com/DataDog/dd-trace-php/issues/953 + missing files in 0.47.0 archive + * Wed Jun 3 2020 Remi Collet <remi@remirepo.net> - 0.46.0-1 - update to 0.46.0 - open https://github.com/DataDog/dd-trace-php/issues/912 |