Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 support #2758

Merged
merged 104 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
a10213c
add PHP 8.4
realFlowControl Jul 12, 2024
af3a62d
PHP 8.4 interceptor compatibility
bwoebi Jul 16, 2024
0b8467f
Add missing dependencies in CircleCI jobs
realFlowControl Jul 16, 2024
139af3e
pecl php 8.4
realFlowControl Jul 16, 2024
d312d22
make appsec compile with PHP 8.4
realFlowControl Jul 16, 2024
45f4e61
Add PHP 8.4 windows support
bwoebi Jul 22, 2024
a039bc9
run verify php 8.4 only on alpine
realFlowControl Jul 22, 2024
0ff25bd
update prof correctness to new closure frames
realFlowControl Jul 23, 2024
4d61679
Reduce visual studio parts needing to be installed
bwoebi Jul 24, 2024
73abe0d
Merge branch 'master' into florian/php-8.4
realFlowControl Aug 1, 2024
d9405e8
fix prof correctness
realFlowControl Aug 1, 2024
d9d83ca
fix PHP 8.4 closure tests
realFlowControl Aug 2, 2024
9ac255b
Merge branch 'master' into florian/php-8.4
realFlowControl Aug 16, 2024
df76e08
update PHP 8.4 to beta3
realFlowControl Aug 16, 2024
704d684
Merge branch 'master' into florian/php-8.4
realFlowControl Aug 23, 2024
9468f2e
fix xdebug
realFlowControl Aug 23, 2024
4870c47
fix circleci
realFlowControl Aug 23, 2024
3c797de
fix appsec
realFlowControl Aug 23, 2024
3f8af60
foo
realFlowControl Aug 23, 2024
95774a6
moah
realFlowControl Aug 23, 2024
81fae34
Fix warning:
bwoebi Aug 23, 2024
86afb44
Fix closures on PHP 8.4 (#2812)
estringana Aug 26, 2024
b6bd48c
Merge branch 'master' into florian/php-8.4
realFlowControl Sep 4, 2024
29864d4
Merge branch 'master' into florian/php-8.4
realFlowControl Sep 12, 2024
17903f0
Merge branch 'master' into florian/php-8.4
realFlowControl Sep 30, 2024
96934a3
update to RC1
realFlowControl Sep 30, 2024
0328543
Fix cross-compile
bwoebi Sep 10, 2024
b25354b
update to RC1
realFlowControl Sep 30, 2024
d27dbed
Merge branch 'florian/php-8.4' of github.com:DataDog/dd-trace-php int…
realFlowControl Oct 1, 2024
7e724bd
Merge branch 'master' into florian/php-8.4
realFlowControl Oct 1, 2024
1da97c9
fix tests
realFlowControl Oct 1, 2024
f4c3397
fix tests
realFlowControl Oct 1, 2024
4be2428
fix
realFlowControl Oct 1, 2024
f7c3c3a
fix
realFlowControl Oct 1, 2024
6e27121
fix xdebug
realFlowControl Oct 1, 2024
96bdd6e
sdf
realFlowControl Oct 1, 2024
cfbbd67
fix comment
realFlowControl Oct 1, 2024
6e00cab
set xdebug for loader test
realFlowControl Oct 1, 2024
50cf5a0
Merge branch 'master' into florian/php-8.4
realFlowControl Oct 1, 2024
b7fbbe8
Merge branch 'master' into florian/php-8.4
realFlowControl Oct 2, 2024
417fb4e
Merge branch 'master' of github.com:DataDog/dd-trace-php into florian…
bwoebi Oct 8, 2024
ee1e723
Adapt to PHP 8.4 stuff
bwoebi Oct 8, 2024
ef81a16
Merge branch 'master' into florian/php-8.4
realFlowControl Oct 11, 2024
fc7a73a
fix build extension
realFlowControl Oct 11, 2024
70b838c
sdf
realFlowControl Oct 11, 2024
de2d84e
update to llvm 17
realFlowControl Oct 11, 2024
248a3f9
sdf
realFlowControl Oct 11, 2024
9c85af3
cmake
realFlowControl Oct 11, 2024
6a8c54c
fix fix fix
realFlowControl Oct 11, 2024
d408fa0
add libltdl-dev for php 7
realFlowControl Oct 11, 2024
9f27137
add libltdl-dev for php 7
realFlowControl Oct 11, 2024
0885832
asdf
realFlowControl Oct 11, 2024
0c57ee8
fix warning `as` vs `AS`
realFlowControl Oct 14, 2024
c4a2fb6
use new asan
realFlowControl Oct 14, 2024
d0f3cbd
Merge branch 'master' into florian/php-8.4
realFlowControl Oct 14, 2024
e763be7
bump llvm to 17
realFlowControl Oct 14, 2024
a081cae
fix xdebug php 8.3Ä
realFlowControl Oct 14, 2024
8ca6505
Add missing libclang-rt-17-dev
realFlowControl Oct 14, 2024
200c1dd
Merge branch 'master' into florian/php-8.4
realFlowControl Oct 14, 2024
ad84f5a
Include frameless functions in stack walk
bwoebi Oct 15, 2024
828cc6d
fix php < 8.4 compile
realFlowControl Oct 15, 2024
8faa6ad
fix: warning about unused variable
morrisonlevi Oct 15, 2024
1459e0f
perf: PHP 8.4+ doesn't need zend_execute_internal
morrisonlevi Oct 15, 2024
ebacc8d
add zts to buster php 7
realFlowControl Oct 22, 2024
75196d3
add tar
realFlowControl Oct 22, 2024
916b2ac
Add clang ASAN handling
bwoebi Oct 23, 2024
bb5f2c7
stuff
realFlowControl Oct 23, 2024
0a2b6ab
Merge branch 'florian/php-8.4' of github.com:DataDog/dd-trace-php int…
realFlowControl Oct 23, 2024
5e27da7
Fix asan stuff
bwoebi Oct 24, 2024
533bf44
updates
realFlowControl Oct 24, 2024
a8063ee
Use cc instead of gcc in CI
bwoebi Oct 24, 2024
adeb7e2
fix 8.1
realFlowControl Oct 24, 2024
06a23f1
Merge branch 'florian/php-8.4' of github.com:DataDog/dd-trace-php int…
realFlowControl Oct 24, 2024
ad3a90e
fix
realFlowControl Oct 24, 2024
45bbbe7
upadte 8.3 in other OS as well
realFlowControl Oct 24, 2024
c769c16
Fix compile issues
bwoebi Oct 24, 2024
017195e
update 8.4 to rc3
realFlowControl Oct 24, 2024
4b96066
Merge branch 'florian/php-8.4' of github.com:DataDog/dd-trace-php int…
realFlowControl Oct 24, 2024
44b33b5
Try fix more compile issues
bwoebi Oct 24, 2024
e6933a3
fix llvm vs gcc flags
realFlowControl Oct 24, 2024
46bfd15
fix dns_check_record()
realFlowControl Oct 24, 2024
845b371
Fix sidecar asan
bwoebi Oct 24, 2024
1cae186
Fix sidecar asan
bwoebi Oct 24, 2024
495e30b
Merge branch 'florian/php-8.4' of github.com:DataDog/dd-trace-php int…
realFlowControl Oct 24, 2024
4906c7d
sdf
realFlowControl Oct 24, 2024
9a5642b
Fix sidecar asan
bwoebi Oct 24, 2024
e69ed7f
Update php 8.4 windows version
bwoebi Oct 24, 2024
a1c7316
Fix everything
bwoebi Oct 25, 2024
38ee785
update
realFlowControl Oct 25, 2024
a4d3035
fix coverage
realFlowControl Oct 25, 2024
bdee0b8
xfail test
realFlowControl Oct 25, 2024
0226121
Fix more stuff
bwoebi Oct 25, 2024
5603a76
Merge branch 'master' of github.com:DataDog/dd-trace-php into florian…
bwoebi Oct 25, 2024
e3cfb46
test
realFlowControl Oct 25, 2024
e5d9dbd
Merge branch 'florian/php-8.4' of github.com:DataDog/dd-trace-php int…
realFlowControl Oct 25, 2024
446e669
Fix
bwoebi Oct 25, 2024
66b0e4e
Make coverage jobs independent
bwoebi Oct 25, 2024
649fc87
Skip ubsan tea tests for PHP 7.0-7.3
bwoebi Oct 25, 2024
8f5b327
Exclude some tests from running
bwoebi Oct 25, 2024
c99434b
fix cmake asan
realFlowControl Oct 28, 2024
00e940d
disable code coverage
realFlowControl Oct 28, 2024
006d76b
Fix tea tests
bwoebi Oct 28, 2024
2a9899e
It's forbidden to use EG(uninitialized_zval) in ZTS in startup
bwoebi Oct 28, 2024
2c614f2
Fix stacktarget handling in zai_hook_safe_finish
bwoebi Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 195 additions & 31 deletions .circleci/continue_config.yml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .github/workflows/prof_asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
prof-asan:
runs-on: ubuntu-latest
container:
image: datadog/dd-trace-ci:php-8.3_bookworm-3
image: datadog/dd-trace-ci:php-8.3_bookworm-4
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
options: --user root --privileged

Expand Down Expand Up @@ -35,10 +35,10 @@ jobs:
switch-php nts-asan
cd profiling
export CARGO_TARGET_DIR=/tmp/build-cargo
export CC=clang-16
export CC=clang-17
export CFLAGS='-fsanitize=address -fno-omit-frame-pointer'
export LDFLAGS='-fsanitize=address'
export RUSTC_LINKER=lld-16
export RUSTC_LINKER=lld-17
triplet=$(uname -m)-unknown-linux-gnu
RUST_NIGHTLY_VERSION="-2024-02-27"
RUSTFLAGS='-Zsanitizer=address' cargo +nightly${RUST_NIGHTLY_VERSION} build -Zbuild-std --target $triplet --release
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/prof_correctness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [8.0, 8.1, 8.2, 8.3]
php-version: [8.0, 8.1, 8.2, 8.3, 8.4]
phpts: [nts, zts]
include:
- phpts: zts
Expand Down Expand Up @@ -44,13 +44,13 @@ jobs:

- name: Build profiler
run: |
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee -a /etc/apt/sources.list
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
curl https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt remove -y clang-*
sudo apt-get update
sudo apt install -y clang-16
sudo apt install -y clang-17
cd profiling
version_number=$(awk -F' = ' '$1 == "channel" { gsub(/"/, "", $2); print $2 }' rust-toolchain.toml)
curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal -y --default-toolchain "$version_number"
Expand Down
4 changes: 4 additions & 0 deletions .gitlab/ci-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CentOS:
matrix:
- PHP_VERSION:
- base
- php-8.4
- php-8.3
- php-8.2
- php-8.1
Expand All @@ -46,6 +47,7 @@ Alpine Compile Extension:
matrix:
- PHP_VERSION:
- base-alpine
- 8.4-alpine
- 8.3-alpine
- 8.2-alpine
- 8.1-alpine
Expand All @@ -72,6 +74,7 @@ Ubuntu Bookworm:
matrix:
- PHP_VERSION:
- base
- php-8.4
- php-8.3
- php-8.2
- php-8.1
Expand Down Expand Up @@ -100,6 +103,7 @@ Ubuntu Buster:
matrix:
- PHP_VERSION:
- base
- php-8.4
- php-8.3
- php-8.2
- php-8.1
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Q := @
, := ,
PROJECT_ROOT := ${PWD}
TRACER_SOURCE_DIR := $(PROJECT_ROOT)/src/
ASAN ?= $(shell ldd $(shell which php) 2>/dev/null | grep -q libasan && echo 1)
ASAN ?= $(shell ldd $(shell which php) 2>/dev/null | grep -q asan && echo 1)
SHELL = /bin/bash
APPSEC_SOURCE_DIR = $(PROJECT_ROOT)/appsec/
BUILD_SUFFIX = extension
Expand Down Expand Up @@ -261,6 +261,9 @@ build_tea_coverage:
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TEA_TESTING=$(TEA_BUILD_TESTS) \
-DCMAKE_C_FLAGS="-O0 --coverage" \
-DCMAKE_SHARED_LINKER_FLAGS="--coverage" \
-DCMAKE_MODULE_LINKER_FLAGS="--coverage" \
-DCMAKE_EXE_LINKER_FLAGS="--coverage" \
-DPhpConfig_ROOT=$(shell php-config --prefix) \
$(PROJECT_ROOT)/tea; \
$(MAKE) $(MAKEFLAGS) && touch $(TEA_BUILD_DIR)/.built.coverage; \
Expand Down Expand Up @@ -301,7 +304,7 @@ build_zai_coverage: install_tea_coverage
cd $(ZAI_BUILD_DIR); \
CMAKE_PREFIX_PATH=/opt/catch2 \
Tea_ROOT=$(TEA_INSTALL_DIR) \
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-O0 --coverage" -DBUILD_ZAI_TESTING=ON -DPhpConfig_ROOT=$(shell php-config --prefix) $(PROJECT_ROOT)/zend_abstract_interface; \
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-O0 --coverage" -DCMAKE_SHARED_LINKER_FLAGS="--coverage" -DCMAKE_MODULE_LINKER_FLAGS="--coverage" -DCMAKE_EXE_LINKER_FLAGS="--coverage" -DBUILD_ZAI_TESTING=ON -DPhpConfig_ROOT=$(shell php-config --prefix) $(PROJECT_ROOT)/zend_abstract_interface; \
$(MAKE) $(MAKEFLAGS); \
)

Expand All @@ -315,7 +318,7 @@ build_components_coverage:
( \
mkdir -p "$(COMPONENTS_BUILD_DIR)"; \
cd $(COMPONENTS_BUILD_DIR); \
CMAKE_PREFIX_PATH=/opt/catch2 cmake -DCMAKE_BUILD_TYPE=Debug -DDATADOG_PHP_TESTING=ON -DCMAKE_C_FLAGS="-O0 --coverage" $(PROJECT_ROOT)/components; \
CMAKE_PREFIX_PATH=/opt/catch2 cmake -DCMAKE_BUILD_TYPE=Debug -DDATADOG_PHP_TESTING=ON -DCMAKE_C_FLAGS="-O0 --coverage" -DCMAKE_SHARED_LINKER_FLAGS="--coverage" -DCMAKE_MODULE_LINKER_FLAGS="--coverage" -DCMAKE_EXE_LINKER_FLAGS="--coverage" $(PROJECT_ROOT)/components; \
$(MAKE) $(MAKEFLAGS); \
)

Expand Down Expand Up @@ -1262,7 +1265,9 @@ test_integrations_frankenphp: global_test_run_dependencies
test_integrations_roadrunner: global_test_run_dependencies tests/Frameworks/Roadrunner/Version_2/composer.lock-php$(PHP_MAJOR_MINOR)
$(call run_tests_debug,tests/Integrations/Roadrunner/V2)
test_integrations_sqlsrv: global_test_run_dependencies
$(eval TEST_EXTRA_INI=-d extension=sqlsrv.so)
$(call run_tests_debug,tests/Integrations/SQLSRV)
$(eval TEST_EXTRA_INI=)
test_integrations_swoole_5: global_test_run_dependencies
$(call run_tests_debug,--testsuite=swoole-test)
test_web_cakephp_28: global_test_run_dependencies tests/Frameworks/CakePHP/Version_2_8/composer.lock-php$(PHP_MAJOR_MINOR)
Expand Down
2 changes: 1 addition & 1 deletion appsec/cmake/run_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ add_custom_target(xtest-prepare
COMMAND mkdir -p /tmp/appsec-ext-test)

add_custom_target(xtest
COMMAND ${CMAKE_COMMAND} -E env "DD_TRACE_GIT_METADATA_ENABLED=0"
COMMAND ${CMAKE_COMMAND} -E env "DD_TRACE_GIT_METADATA_ENABLED=0" "LSAN_OPTIONS=fast_unwind_on_malloc=0"
${CMAKE_SOURCE_DIR}/cmake/run-tests-wrapper.sh
"${CMAKE_BINARY_DIR}" "$<TARGET_FILE:mock_helper>" "${DD_APPSEC_TRACER_EXT_FILE}"
"${PhpConfig_PHP_BINARY}" -n -d variables_order=EGPCS
Expand Down
10 changes: 7 additions & 3 deletions appsec/src/extension/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// This product includes software developed at Datadog
// (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
#include "backtrace.h"
#include "compatibility.h"
#include "configuration.h"
#include "ddtrace.h"
#include "logging.h"
Expand Down Expand Up @@ -64,7 +65,10 @@ php_backtrace_frame_to_datadog_backtrace_frame( // NOLINTNEXTLINE(bugprone-easil
}

// Remove tracer integration php code frames
if (strncmp(Z_STRVAL_P(function), "DDTrace", sizeof("DDTrace") - 1) == 0) {
if (STR_STARTS_WITH_CONS(
Z_STRVAL_P(function), Z_STRLEN_P(function), "DDTrace") ||
STR_STARTS_WITH_CONS(
Z_STRVAL_P(function), Z_STRLEN_P(function), "{closure:DDTrace")) {
return false;
}

Expand Down Expand Up @@ -306,8 +310,8 @@ ZEND_END_ARG_INFO()

// clang-format off
static const zend_function_entry testing_functions[] = {
ZEND_RAW_FENTRY(DD_TESTING_NS "generate_backtrace", PHP_FN(datadog_appsec_testing_generate_backtrace), void_ret_array_arginfo,0)
ZEND_RAW_FENTRY(DD_TESTING_NS "report_exploit_backtrace", PHP_FN(datadog_appsec_testing_report_exploit_backtrace), void_ret_bool_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "generate_backtrace", PHP_FN(datadog_appsec_testing_generate_backtrace), void_ret_array_arginfo,0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "report_exploit_backtrace", PHP_FN(datadog_appsec_testing_report_exploit_backtrace), void_ret_bool_arginfo, 0, NULL, NULL)
PHP_FE_END
};
// clang-format on
Expand Down
2 changes: 1 addition & 1 deletion appsec/src/extension/commands_ctx.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "attributes.h"
#include <php.h>
#include "attributes.h"

struct req_info {
const char *nullable command_name; // for logging
Expand Down
2 changes: 1 addition & 1 deletion appsec/src/extension/commands_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
#pragma once

#include "attributes.h"
#include "commands_ctx.h"
#include "attributes.h"
#include "dddefs.h"
#include "network.h"
#include <mpack.h>
Expand Down
11 changes: 11 additions & 0 deletions appsec/src/extension/compatibility.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef DD_COMPATIBILITY_H
#define DD_COMPATIBILITY_H

#include <php.h>

#if PHP_VERSION_ID < 80400
#undef ZEND_RAW_FENTRY
#define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags, ...) { zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
#endif

#endif // DD_COMPATIBILITY_H
6 changes: 4 additions & 2 deletions appsec/src/extension/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "user_tracking.h"
#include "zai_string/string.h"

#include "compatibility.h"

#define DD_TO_DATADOG_INC 5 /* "DD" expanded to "datadog" */

#define APPLY_0(...)
Expand Down Expand Up @@ -285,8 +287,8 @@ ZEND_END_ARG_INFO()

// clang-format off
static const zend_function_entry testing_functions[] = {
ZEND_RAW_FENTRY(DD_TESTING_NS "zai_config_get_value", PHP_FN(datadog_appsec_testing_zai_config_get_value), set_string_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "zai_config_get_global_value", PHP_FN(datadog_appsec_testing_zai_config_get_global_value), set_string_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "zai_config_get_value", PHP_FN(datadog_appsec_testing_zai_config_get_value), set_string_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "zai_config_get_global_value", PHP_FN(datadog_appsec_testing_zai_config_get_global_value), set_string_arginfo, 0, NULL, NULL)
PHP_FE_END
};
// clang-format on
Expand Down
15 changes: 8 additions & 7 deletions appsec/src/extension/ddappsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "commands/request_init.h"
#include "commands/request_shutdown.h"
#include "commands_ctx.h"
#include "compatibility.h"
#include "configuration.h"
#include "ddappsec.h"
#include "dddefs.h"
Expand Down Expand Up @@ -542,16 +543,16 @@ ZEND_END_ARG_INFO()

// clang-format off
static const zend_function_entry functions[] = {
ZEND_RAW_FENTRY(DD_APPSEC_NS "is_enabled", PHP_FN(datadog_appsec_is_enabled), void_ret_bool_arginfo, 0)
ZEND_RAW_FENTRY(DD_APPSEC_NS "push_address", PHP_FN(datadog_appsec_push_address), push_address_arginfo, 0)
ZEND_RAW_FENTRY(DD_APPSEC_NS "is_enabled", PHP_FN(datadog_appsec_is_enabled), void_ret_bool_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_APPSEC_NS "push_address", PHP_FN(datadog_appsec_push_address), push_address_arginfo, 0, NULL, NULL)
PHP_FE_END
};
static const zend_function_entry testing_functions[] = {
ZEND_RAW_FENTRY(DD_TESTING_NS "rinit", PHP_FN(datadog_appsec_testing_rinit), void_ret_bool_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "rshutdown", PHP_FN(datadog_appsec_testing_rshutdown), void_ret_bool_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "helper_mgr_acquire_conn", PHP_FN(datadog_appsec_testing_helper_mgr_acquire_conn), void_ret_bool_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "stop_for_debugger", PHP_FN(datadog_appsec_testing_stop_for_debugger), void_ret_bool_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "request_exec", PHP_FN(datadog_appsec_testing_request_exec), request_exec_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "rinit", PHP_FN(datadog_appsec_testing_rinit), void_ret_bool_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "rshutdown", PHP_FN(datadog_appsec_testing_rshutdown), void_ret_bool_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "helper_mgr_acquire_conn", PHP_FN(datadog_appsec_testing_helper_mgr_acquire_conn), void_ret_bool_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "stop_for_debugger", PHP_FN(datadog_appsec_testing_stop_for_debugger), void_ret_bool_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "request_exec", PHP_FN(datadog_appsec_testing_request_exec), request_exec_arginfo, 0, NULL, NULL)
PHP_FE_END
};
// clang-format on
Expand Down
2 changes: 1 addition & 1 deletion appsec/src/extension/ddappsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
// This header MUST be included in files that use EG/PG/OG/...
// See https://bugs.php.net/bug.php?id=81634

#include "attributes.h"
#include "logging.h"
#include "version.h"
#include <php.h>
#include <stdbool.h>
#include "attributes.h"

typedef enum _enabled_configuration {
APPSEC_ENABLED_VIA_REMCFG = 0,
Expand Down
13 changes: 7 additions & 6 deletions appsec/src/extension/ddtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <fcntl.h>
#include <unistd.h>

#include "compatibility.h"
#include "configuration.h"
#include "ddappsec.h"
#include "logging.h"
Expand Down Expand Up @@ -504,12 +505,12 @@ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
ZEND_END_ARG_INFO()

static const zend_function_entry functions[] = {
ZEND_RAW_FENTRY(DD_TESTING_NS "ddtrace_rshutdown", PHP_FN(datadog_appsec_testing_ddtrace_rshutdown), void_ret_bool_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "root_span_add_tag", PHP_FN(datadog_appsec_testing_root_span_add_tag), arginfo_root_span_add_tag, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "root_span_get_meta", PHP_FN(datadog_appsec_testing_root_span_get_meta), void_ret_nullable_array, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "root_span_get_meta_struct", PHP_FN(datadog_appsec_testing_root_span_get_meta_struct), void_ret_nullable_array, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "root_span_get_metrics", PHP_FN(datadog_appsec_testing_root_span_get_metrics), void_ret_nullable_array, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "get_formatted_runtime_id", PHP_FN(datadog_appsec_testing_get_formatted_runtime_id), void_ret_nullable_string, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "ddtrace_rshutdown", PHP_FN(datadog_appsec_testing_ddtrace_rshutdown), void_ret_bool_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "root_span_add_tag", PHP_FN(datadog_appsec_testing_root_span_add_tag), arginfo_root_span_add_tag, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "root_span_get_meta", PHP_FN(datadog_appsec_testing_root_span_get_meta), void_ret_nullable_array, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "root_span_get_meta_struct", PHP_FN(datadog_appsec_testing_root_span_get_meta_struct), void_ret_nullable_array, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "root_span_get_metrics", PHP_FN(datadog_appsec_testing_root_span_get_metrics), void_ret_nullable_array, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "get_formatted_runtime_id", PHP_FN(datadog_appsec_testing_get_formatted_runtime_id), void_ret_nullable_string, 0, NULL, NULL)
PHP_FE_END
};
// clang-format on
Expand Down
2 changes: 1 addition & 1 deletion appsec/src/extension/ddtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
// (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
#pragma once

#include "attributes.h"
#include <stdbool.h>
#include <zend.h>
#include "attributes.h"

static const int PRIORITY_SAMPLING_AUTO_KEEP = 1;
static const int PRIORITY_SAMPLING_AUTO_REJECT = 0;
Expand Down
2 changes: 1 addition & 1 deletion appsec/src/extension/entity_body.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Copyright 2021 Datadog, Inc.
#pragma once

#include "attributes.h"
#include <php.h>
#include "attributes.h"
#include <stdbool.h>

void dd_entity_body_startup(void);
Expand Down
7 changes: 4 additions & 3 deletions appsec/src/extension/helper_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <stdbool.h>

#define HELPER_PROCESS_C_INCLUDES
#include "compatibility.h"
#include "configuration.h"
#include "ddappsec.h"
#include "dddefs.h"
Expand Down Expand Up @@ -325,9 +326,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(void_ret_array_arginfo, 0, 0, IS_ARRAY,
ZEND_END_ARG_INFO()

static const zend_function_entry functions[] = {
ZEND_RAW_FENTRY(DD_TESTING_NS "set_helper_path", PHP_FN(datadog_appsec_testing_set_helper_path), set_string_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "is_connected_to_helper", PHP_FN(datadog_appsec_testing_is_connected_to_helper), void_ret_bool_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "backoff_status", PHP_FN(datadog_appsec_testing_backoff_status), void_ret_array_arginfo, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "set_helper_path", PHP_FN(datadog_appsec_testing_set_helper_path), set_string_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "is_connected_to_helper", PHP_FN(datadog_appsec_testing_is_connected_to_helper), void_ret_bool_arginfo, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "backoff_status", PHP_FN(datadog_appsec_testing_backoff_status), void_ret_array_arginfo, 0, NULL, NULL)
PHP_FE_END
};
// clang-format on
Expand Down
3 changes: 2 additions & 1 deletion appsec/src/extension/ip_extraction.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.

#include "ip_extraction.h"
#include "compatibility.h"
#include "configuration.h"
#include "ddtrace.h"
#include "logging.h"
Expand Down Expand Up @@ -38,7 +39,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(extract_ip_addr, 0, 1, IS_STRING, 1)
ZEND_END_ARG_INFO()

static const zend_function_entry functions[] = {
ZEND_RAW_FENTRY(DD_TESTING_NS "extract_ip_addr", PHP_FN(datadog_appsec_testing_extract_ip_addr), extract_ip_addr, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "extract_ip_addr", PHP_FN(datadog_appsec_testing_extract_ip_addr), extract_ip_addr, 0, NULL, NULL)
PHP_FE_END
};
// clang-format on
Expand Down
9 changes: 6 additions & 3 deletions appsec/src/extension/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// This product includes software developed at Datadog
// (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
#include "logging.h"
#include "attributes.h"
#include "compatibility.h"
#include "configuration.h"
#include "ddappsec.h"
#include "dddefs.h"
Expand All @@ -18,6 +18,9 @@
#include <stdbool.h>
#include <syslog.h>
#include <time.h>

#include "attributes.h"

#ifdef __linux__
# include <sys/syscall.h>
#endif
Expand Down Expand Up @@ -564,8 +567,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(fdclose, 0, 1, _IS_BOOL, 0)
ZEND_END_ARG_INFO()

static const zend_function_entry functions[] = {
ZEND_RAW_FENTRY(DD_TESTING_NS "mlog", PHP_FN(datadog_appsec_testing_mlog), mlog, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "fdclose", PHP_FN(datadog_appsec_testing_fdclose), fdclose, 0)
ZEND_RAW_FENTRY(DD_TESTING_NS "mlog", PHP_FN(datadog_appsec_testing_mlog), mlog, 0, NULL, NULL)
ZEND_RAW_FENTRY(DD_TESTING_NS "fdclose", PHP_FN(datadog_appsec_testing_fdclose), fdclose, 0, NULL, NULL)
PHP_FE_END
};
// clang-format on
Expand Down
2 changes: 1 addition & 1 deletion appsec/src/extension/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
#pragma once

#include "attributes.h"
#include "configuration.h"
#include "php_helpers.h"
#include <stdbool.h>
#include "attributes.h"

/* log levels - the first argument to the mlog helper
* The lower the number, the higher the priority */
Expand Down
Loading
Loading