Skip to content

Commit

Permalink
PHP 8.4 support (#2758)
Browse files Browse the repository at this point in the history
* add PHP 8.4

* PHP 8.4 interceptor compatibility

Signed-off-by: Bob Weinand <[email protected]>

* Add missing dependencies in CircleCI jobs

* pecl php 8.4

* make appsec compile with PHP 8.4

* Add PHP 8.4 windows support

* run verify php 8.4 only on alpine

* update prof correctness to new closure frames

* Reduce visual studio parts needing to be installed

* fix prof correctness

* fix PHP 8.4 closure tests

* update PHP 8.4 to beta3

* fix xdebug

* fix circleci

* fix appsec

* Fix warning:

Warning: JIT on AArch64 doesn't support opcache.jit_buffer_size above 128M. in Unknown on line 0
Signed-off-by: Bob Weinand <[email protected]>

* Fix closures on PHP 8.4 (#2812)

* update to RC1

* Fix cross-compile

Signed-off-by: Bob Weinand <[email protected]>

* update to RC1

* fix tests

* fix xdebug

* fix comment

* set xdebug for loader test

* Adapt to PHP 8.4 stuff

Signed-off-by: Bob Weinand <[email protected]>

* fix build extension

* update to llvm 17

* cmake

* add libltdl-dev for php 7

* add libltdl-dev for php 7

* asdf

* fix warning `as` vs `AS`

* use new asan

* bump llvm to 17

* fix xdebug php 8.3Ä

* Add missing libclang-rt-17-dev

* Include frameless functions in stack walk

Signed-off-by: Bob Weinand <[email protected]>

* fix php < 8.4 compile

* fix: warning about unused variable

* perf: PHP 8.4+ doesn't need zend_execute_internal

* add zts to buster php 7

* add tar

* Add clang ASAN handling

Signed-off-by: Bob Weinand <[email protected]>

* stuff

* Fix asan stuff

Signed-off-by: Bob Weinand <[email protected]>

* updates

* Use cc instead of gcc in CI

Signed-off-by: Bob Weinand <[email protected]>

* fix 8.1

* fix

* upadte 8.3 in other OS as well

* Fix compile issues

Signed-off-by: Bob Weinand <[email protected]>

* update 8.4 to rc3

* Try fix more compile issues

Signed-off-by: Bob Weinand <[email protected]>

* fix llvm vs gcc flags

* fix dns_check_record()

* Fix sidecar asan

Signed-off-by: Bob Weinand <[email protected]>

* Update php 8.4 windows version

* Fix everything

Signed-off-by: Bob Weinand <[email protected]>

Signed-off-by: Bob Weinand <[email protected]>

* Make coverage jobs independent

Signed-off-by: Bob Weinand <[email protected]>

* Skip ubsan tea tests for PHP 7.0-7.3

Signed-off-by: Bob Weinand <[email protected]>

* Exclude some tests from running

Signed-off-by: Bob Weinand <[email protected]>

* fix cmake asan

* disable code coverage

* Fix tea tests

Signed-off-by: Bob Weinand <[email protected]>

* It's forbidden to use EG(uninitialized_zval) in ZTS in startup

Signed-off-by: Bob Weinand <[email protected]>

* Fix stacktarget handling in zai_hook_safe_finish

Signed-off-by: Bob Weinand <[email protected]>

---------

Signed-off-by: Bob Weinand <[email protected]>
Co-authored-by: Bob Weinand <[email protected]>
Co-authored-by: Alejandro Estringana Ruiz <[email protected]>
Co-authored-by: Levi Morrison <[email protected]>
  • Loading branch information
4 people authored Oct 30, 2024
1 parent 093ef34 commit 73e9db0
Show file tree
Hide file tree
Showing 146 changed files with 2,596 additions and 470 deletions.
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

0 comments on commit 73e9db0

Please sign in to comment.