Skip to content

Commit 745c0de

Browse files
committed
test: fix 8.5 language tests
Signed-off-by: Alexandre Rulleau <[email protected]>
1 parent 1ce2b9a commit 745c0de

File tree

6 files changed

+67
-21
lines changed

6 files changed

+67
-21
lines changed

.gitlab/generate-tracer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ function before_script_steps() {
652652
["8.2", "3.2.2"],
653653
["8.3", "3.3.2"],
654654
["8.4", "3.4.0"],
655-
// ["8.5", "3.4.5"], Xdebug not supported yet on 8.5
655+
// ["8.5", "3.5.0"], Xdebug not supported yet on 8.5
656656
];
657657
foreach ($xdebug_test_matrix as [$major_minor, $xdebug]):
658658
?>

dockerfiles/ci/centos/7/base.Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ ENV PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/usr/local/lib6
172172

173173
# Caution, takes a very long time! Since we have to build one from source,
174174
# I picked LLVM 17, which matches Rust 1.76.
175+
# Ordinarily we leave sources, but LLVM is 2GiB just for the sources...
176+
# Minimum: libclang. Nice-to-have: full toolchain including linker to play
177+
# with cross-language link-time optimization. Needs to match rustc -Vv's llvm
178+
# version.
175179
RUN source scl_source enable devtoolset-9 \
176180
&& yum install -y python3 \
177181
&& /root/download-src.sh ninja https://github.com/ninja-build/ninja/archive/refs/tags/v1.11.0.tar.gz \
@@ -217,6 +221,7 @@ RUN source scl_source enable devtoolset-7 \
217221
ARG RUST_VERSION="1.84.1"
218222
ARG RUST_SHA256_ARM="be89f6ad9b70cc4b25182ae299f94ab047a713a51fddf95284823c8afe4aef85"
219223
ARG RUST_SHA256_X86="106c89f23ce1c763fcbea8e2714b2ba869bf7af70804813987a4483896398933"
224+
# Mount a cache into /rust/cargo if you want to pre-fetch packages or something
220225
ENV CARGO_HOME=/rust/cargo
221226
ENV RUSTUP_HOME=/rust/rustup
222227
RUN source scl_source enable devtoolset-7 \

dockerfiles/ci/xfail_tests/8.5.list

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ Zend/tests/arginfo_zpp_mismatch_strict.phpt
44
Zend/tests/bug63882_2.phpt
55
Zend/tests/bug69315.phpt
66
Zend/tests/bug70258.phpt
7-
Zend/tests/bug70805.phpt
8-
Zend/tests/bug70805_1.phpt
9-
Zend/tests/bug70805_2.phpt
7+
Zend/tests/gc/bug70805.phpt
8+
Zend/tests/gc/bug70805_1.phpt
9+
Zend/tests/gc/bug70805_2.phpt
10+
Zend/tests/disable_classes_warning.phpt
1011
Zend/tests/bug71539_5.phpt
1112
Zend/tests/bug72038.phpt
1213
Zend/tests/bug75921.phpt
@@ -18,8 +19,8 @@ Zend/tests/fibers/out-of-memory-in-fiber.phpt
1819
Zend/tests/fibers/out-of-memory-in-nested-fiber.phpt
1920
Zend/tests/fibers/out-of-memory-in-recursive-fiber.phpt
2021
Zend/tests/gc_031.phpt
21-
Zend/tests/gc_037.phpt
22-
Zend/tests/gc_045.phpt
22+
Zend/tests/gc/gc_037.phpt
23+
Zend/tests/gc/gc_045.phpt
2324
Zend/tests/get_defined_functions_basic.phpt
2425
Zend/tests/get_required_files.phpt
2526
Zend/tests/gh7958.phpt
@@ -217,3 +218,4 @@ ext/standard/tests/http/ghsa-hgf5-96fm-v528-003.phpt
217218
ext/standard/tests/http/ghsa-hgf5-96fm-v528-002.phpt
218219
ext/standard/tests/http/ghsa-hgf5-96fm-v528-001.phpt
219220
ext/standard/tests/http/ignore_errors.phpt
221+
ext/posix/tests/posix_getgrnam_basic.phpt

dockerfiles/ci/xfail_tests/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,10 @@ The exact PHP version that a given test checks this env var varies, but these
211211
are some tests which are skipped for older versions which don't check it:
212212

213213
- `ext/sockets/tests/socket_shutdown.phpt`
214+
215+
## `Zend/tests/disable_classes_warning.phpt`
216+
217+
Disabled on versions: `8.5+`.
218+
219+
PHP 8.5 completely removed the `disable_classes` INI directive (see [RFC](https://wiki.php.net/rfc/remove_disable_classes)).
220+

dockerfiles/verify_packages/verify.sh

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
set -e
44

55
export DD_REMOTE_CONFIG_ENABLED=false
6-
export DD_TRACE_DEBUG=1
7-
export DD_TRACE_LOG_FILE=/tmp/log
86

97
# Installing generic dependencies. OS_ID='centos'|'debian'|'alpine'
108
OS_ID=$(. /etc/os-release; echo $ID)
@@ -36,24 +34,20 @@ fi
3634
echo "PHP version: $(${DD_TRACE_PHP_BIN} -v)"
3735

3836
# Script output
39-
# Explicitly enable CLI tracing and force flush on shutdown for installer-based installations
40-
# Set high flush interval to prevent premature flush of empty traces before shutdown
41-
CLI_OUTPUT=$(${DD_TRACE_PHP_BIN} -d datadog.trace.cli_enabled=1 -d datadog.trace.force_flush_on_shutdown=1 -d datadog.trace.agent_flush_interval=999999 /var/www/html/index.php)
37+
CLI_OUTPUT=$(${DD_TRACE_PHP_BIN} /var/www/html/index.php)
4238
if [ "${CLI_OUTPUT}" != "hi" ]; then
4339
echo "Error: expected request output is 'hi'. Actual:\n${APACHE_OUTPUT}"
44-
cat /tmp/log
4540
exit 1
4641
else
4742
echo "Request output is correct"
4843
fi
4944

50-
# Trace exists - increased sleep time for installer-based installations with shutdown flush
51-
sleep 3
45+
# Trace exists
46+
sleep 1
5247
CLI_TRACES=$(curl -s -L request-replayer/replay)
5348
# sh compatible way to do string contains
5449
if [ "${CLI_TRACES#*trace_id}" = "${CLI_TRACES}" ]; then
5550
echo "Error: traces have not been sent correctly. From request replayer:\n${CLI_TRACES}"
56-
cat /tmp/log
5751
exit 1
5852
else
5953
echo "Traces have been sent is correct"
@@ -73,18 +67,17 @@ curl -s -L request-replayer/clear-dumped-data
7367
NGINX_OUTPUT=$(curl -s -L localhost:8080)
7468
if [ "${NGINX_OUTPUT}" != "hi" ]; then
7569
echo "Error: expected request output is 'hi'. Actual:\n${NGINX_OUTPUT}"
76-
cat /tmp/log
7770
exit 1
7871
else
7972
echo "Request output is correct"
8073
fi
8174

82-
sleep 3
75+
# Trace exists: waiting more than DD_TRACE_AGENT_FLUSH_INTERVAL=1000
76+
sleep 2
8377
NGINX_TRACES=$(curl -s -L request-replayer/replay)
8478
# sh compatible way to do string contains
8579
if [ "${NGINX_TRACES#*trace_id}" = "${NGINX_TRACES}" ]; then
8680
echo "Error: traces have not been sent correctly. From request replayer:\n${NGINX_TRACES}"
87-
cat /tmp/log
8881
exit 1
8982
else
9083
echo "Traces have been sent is correct"
@@ -105,18 +98,17 @@ if [ "${VERIFY_APACHE:-yes}" != "no" ]; then
10598
APACHE_OUTPUT=$(curl -s -L localhost:8081/index.php)
10699
if [ "${APACHE_OUTPUT}" != "hi" ]; then
107100
echo "Error: expected request output is 'hi'. Actual:\n${APACHE_OUTPUT}"
108-
cat /tmp/log
109101
exit 1
110102
else
111103
echo "Request output is correct"
112104
fi
113105

114-
sleep 3
106+
# Trace exists: waiting more than DD_TRACE_AGENT_FLUSH_INTERVAL=1000
107+
sleep 2
115108
APACHE_TRACES=$(curl -s -L request-replayer/replay)
116109
# sh compatible way to do string contains
117110
if [ "${APACHE_TRACES#*trace_id}" = "${APACHE_TRACES}" ]; then
118111
echo "Error: traces have not been sent correctly. From request replayer:\n${APACHE_TRACES}"
119-
cat /tmp/log
120112
exit 1
121113
else
122114
echo "Traces have been sent is correct"

ext/handlers_exception.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ static zif_handler dd_http_response_code = NULL;
2525
static zif_handler dd_set_error_handler = NULL;
2626
static zif_handler dd_set_exception_handler = NULL;
2727
static zif_handler dd_restore_exception_handler = NULL;
28+
#if PHP_VERSION_ID >= 80500
29+
static zif_handler dd_get_error_handler = NULL;
30+
static zif_handler dd_get_exception_handler = NULL;
31+
#endif
2832

2933
static void dd_check_exception_in_header(int old_response_code) {
3034
int new_response_code = SG(sapi_headers).http_response_code;
@@ -197,6 +201,38 @@ static PHP_FUNCTION(ddtrace_restore_exception_handler) {
197201
}
198202
}
199203

204+
#if PHP_VERSION_ID >= 80500
205+
static PHP_FUNCTION(ddtrace_get_error_handler) {
206+
dd_get_error_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
207+
208+
// Unwrap the handler if it's our wrapper
209+
if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJCE_P(return_value) == &dd_exception_or_error_handler_ce) {
210+
zval *handler = dd_exception_or_error_handler_handler(Z_OBJ_P(return_value));
211+
zval_ptr_dtor(return_value);
212+
if (Z_ISUNDEF_P(handler)) {
213+
ZVAL_NULL(return_value);
214+
} else {
215+
ZVAL_COPY(return_value, handler);
216+
}
217+
}
218+
}
219+
220+
static PHP_FUNCTION(ddtrace_get_exception_handler) {
221+
dd_get_exception_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
222+
223+
// Unwrap the handler if it's our wrapper
224+
if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJCE_P(return_value) == &dd_exception_or_error_handler_ce) {
225+
zval *handler = dd_exception_or_error_handler_handler(Z_OBJ_P(return_value));
226+
zval_ptr_dtor(return_value);
227+
if (Z_ISUNDEF_P(handler)) {
228+
ZVAL_NULL(return_value);
229+
} else {
230+
ZVAL_COPY(return_value, handler);
231+
}
232+
}
233+
}
234+
#endif
235+
200236
static zend_internal_function ddtrace_exception_or_error_handler;
201237

202238
ZEND_BEGIN_ARG_INFO_EX(arginfo_ddtrace_exception_or_error_handler, 0, 0, 1)
@@ -497,6 +533,10 @@ void ddtrace_exception_handlers_startup(void) {
497533
{ZEND_STRL("set_exception_handler"), &dd_set_exception_handler, ZEND_FN(ddtrace_set_exception_handler)},
498534
{ZEND_STRL("restore_exception_handler"), &dd_restore_exception_handler,
499535
ZEND_FN(ddtrace_restore_exception_handler)},
536+
#if PHP_VERSION_ID >= 80500
537+
{ZEND_STRL("get_error_handler"), &dd_get_error_handler, ZEND_FN(ddtrace_get_error_handler)},
538+
{ZEND_STRL("get_exception_handler"), &dd_get_exception_handler, ZEND_FN(ddtrace_get_exception_handler)},
539+
#endif
500540
};
501541
size_t handlers_len = sizeof handlers / sizeof handlers[0];
502542
for (size_t i = 0; i < handlers_len; ++i) {

0 commit comments

Comments
 (0)