Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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.5
- php-8.4
- php-8.3
- php-8.2
Expand Down Expand Up @@ -47,6 +48,7 @@ Alpine:
matrix:
- PHP_VERSION:
- base-alpine
- 8.5-alpine
- 8.4-alpine
- 8.3-alpine
- 8.2-alpine
Expand Down Expand Up @@ -74,6 +76,7 @@ Bookworm:
matrix:
- PHP_VERSION:
- base
- php-8.5
- php-8.4
- php-8.3
- php-8.2
Expand Down Expand Up @@ -103,6 +106,7 @@ Buster:
matrix:
- PHP_VERSION:
- base
- php-8.5
- php-8.4
- php-8.3
- php-8.2
Expand Down
2 changes: 2 additions & 0 deletions .gitlab/generate-appsec.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@
- test8.3-release-zts
- test8.4-release
- test8.4-release-zts
- test8.5-release
- test8.5-release-zts
before_script:
<?php echo $ecrLoginSnippet, "\n"; ?>
script:
Expand Down
1 change: 1 addition & 0 deletions .gitlab/generate-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"8.2" => "20220829",
"8.3" => "20230831",
"8.4" => "20240924",
"8.5" => "20250925",
];

$all_minor_major_targets = array_keys($php_versions_to_abi);
Expand Down
1 change: 1 addition & 0 deletions .gitlab/generate-tracer.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ function before_script_steps() {
["8.2", "3.2.2"],
["8.3", "3.3.2"],
["8.4", "3.4.0"],
// ["8.5", "3.4.5"], Xdebug not supported yet on 8.5
];
foreach ($xdebug_test_matrix as [$major_minor, $xdebug]):
?>
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ test_c_observer: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-te
$(if $(ASAN), USE_ZEND_ALLOC=0 USE_TRACKED_ALLOC=1) $(ALL_TEST_ENV_OVERRIDE) $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -d extension=zend_test.so -d zend_test.observer.enabled=1 -d zend_test.observer.observe_all=1 -d zend_test.observer.show_output=0 $(BUILD_DIR)/$(TESTS)

test_opcache: $(SO_FILE) $(TEST_OPCACHE_FILES) $(BUILD_DIR)/run-tests.php
$(if $(ASAN), USE_ZEND_ALLOC=0 USE_TRACKED_ALLOC=1) $(RUN_TESTS_CMD) -d extension=$(SO_FILE) -d zend_extension=opcache.so $(BUILD_DIR)/tests/opcache
$(if $(ASAN), USE_ZEND_ALLOC=0 USE_TRACKED_ALLOC=1) $(RUN_TESTS_CMD) -d extension=$(SO_FILE) $(shell test $(PHP_MAJOR_MINOR) -lt 85 && echo "-d zend_extension=opcache.so") $(BUILD_DIR)/tests/opcache

test_c_mem: $(SO_FILE) $(TEST_FILES) $(TEST_STUB_FILES) $(BUILD_DIR)/run-tests.php
$(RUN_TESTS_CMD) -d extension=$(SO_FILE) -m $(BUILD_DIR)/$(TESTS)
Expand Down
2 changes: 2 additions & 0 deletions appsec/tests/extension/module_order_opcache.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Verify ddappsec is always in the module registry after ddtrace when opcache is p
if (!extension_loaded('Zend OPcache')) {
die('skip requires opcache');
}
if (!version_compare(PHP_VERSION, '8.5.0', '>='))
die('skip: opcache is loaded by default in PHP 8.5+');
?>
--INI--
extension=ddtrace.so
Expand Down
2 changes: 1 addition & 1 deletion appsec/tests/integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test {
}
tasks['test'].enabled(false)

ext.testMatrix = ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'].collectMany {
ext.testMatrix = ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'].collectMany {
[[it, 'release'], [it, 'debug'], [it, 'release-zts']]
}
ext.uuid = "id -u".execute().text.trim()
Expand Down
1 change: 1 addition & 0 deletions appsec/tests/integration/gradle/images.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def phpVersions = [
'8.2': '8.2.13',
'8.3': '8.3.0',
'8.4': '8.4.0',
'8.5': '8.5.0',
]

def arch = System.getProperty('os.arch')
Expand Down
14 changes: 13 additions & 1 deletion appsec/tests/integration/gradle/tag_mappings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,17 @@ ext.tag_mappings = [
'php-7.0-release-zts': 'sha256:4bb5fac6fbd3124234d062328c68f6c51027aa95f13e4e8b14afd7c8de518ec6',
'apache2-mod-php-8.4-release': 'sha256:79c2d7dd843b18ce2c5f929e6300e9a1f64a5e00a7edbaeb9f75d8a60b2be3d2',
'php-7.0-release': 'sha256:627c4f460fa1c11f3f5da44d9361eba5de9f38134189ca05b3bfdb9979011e44',
'php-7.1-release-zts': 'sha256:d997b9f99c28967872bd0949f8572b089daaadb6ceaa1e856ccc76e07e2ba6b7'
'php-7.1-release-zts': 'sha256:d997b9f99c28967872bd0949f8572b089daaadb6ceaa1e856ccc76e07e2ba6b7',
'php-8.5-release': 'sha256:85006ca959faac9762c71d2c04456da7b3e668f9433760074170ade846465c2a',
'php-8.5-release-zts': 'sha256:e93dad03fde7f3771bd2390cd34fc2aadd6f2ad2065ec458c06710713a24ff90',
'php-8.5-debug': 'sha256:fff058d6ed5a2de5f06f3c8d1c157879a4926294e17190ff8bcfe54cdfaf025f',
'apache2-fpm-php-8.5-release-zts': 'sha256:45d4416f0ccb887074b4a4c6406c71533a84049312b454c28fc33d18c1fe00fb',
'apache2-fpm-php-8.5-release': 'sha256:1b9b9fb033e20ac867a684adb9084a6ceefa1812baa39308cca47013ce2cf705',
'apache2-fpm-php-8.5-debug': 'sha256:9e82028aac75eb916455938f59d68e412307fcfcad1d4eb37e6d4a75e7a61269',
'apache2-mod-php-8.5-release-zts': 'sha256:f3e8741683433b0fd43ee0eb8dd197b91d6b3e56122963f20df46858c78462d7',
'apache2-mod-php-8.5-release': 'sha256:12ffe23c006de6d74279b0e53390f023bb1f3d132e4d0cbff3a4fd684a9761d2',
'apache2-mod-php-8.5-debug': 'sha256:d16455deab5f5a68b5b3d0ac18e3904d51ff6c30a0107148944b7a6467517edc',
'nginx-fpm-php-8.5-release-zts': 'sha256:a2ecb6bdb630debd9ea61be9b32acd975361f1d13fe2ad325a0dff4b9ef1ea2c',
'nginx-fpm-php-8.5-release': 'sha256:a6a4ff845b68a3e2a35399bedab758e9b47a48ad669e3c9f2f4f3a9367c3ad10',
'nginx-fpm-php-8.5-debug': 'sha256:a62ce17ddb04879e1d3c383ccaf53eb1cbe8e6711679383045dd3de81aed1b47'
]
6 changes: 3 additions & 3 deletions appsec/tests/integration/src/docker/php/build_dev_php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ function download_php {
local download_url
if [[ $version_id -lt 50400 ]]; then
download_url="http://museum.php.net/php5/php-${version}.tar.gz"
elif [[ $version_id -ge 80400 ]]; then
download_url="https://downloads.php.net/~saki/php-8.4.0RC3.tar.gz"
elif [[ $version_id -ge 80500 ]]; then
download_url="https://downloads.php.net/~daniels/php-8.5.0RC1.tar.gz"
else
download_url="https://www.php.net/distributions/php-${version}.tar.gz"
fi
Expand Down Expand Up @@ -81,7 +81,7 @@ chmod +x /tmp/apxs_wrapper
}

function run_dsymutil {
if [[ $(uname) != Darwin ]] then
if [[ $(uname) != Darwin ]]; then
return
fi
local readonly dir=$1 exe=
Expand Down
14 changes: 10 additions & 4 deletions datadog-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,12 @@ function install($options)
$tar_gz_suffix = ""; // retry with the full archive if the original download failed
}
}
if (!IS_WINDOWS || `where tar 2> nul` !== null) {
if (!IS_WINDOWS || shell_exec("where tar 2> nul") !== null) {
execute_or_exit(
"Cannot extract the archive",
"tar -xf " . escapeshellarg($tmpDirTarGz) . " -C " . escapeshellarg($tmpDir)
);
} elseif (($defaultPath = `where 7z 2> nul`) !== null || @is_dir($installDir7z = getenv("PROGRAMFILES") . "\\7-Zip")) {
} elseif (($defaultPath = shell_exec("where 7z 2> nul")) !== null || @is_dir($installDir7z = getenv("PROGRAMFILES") . "\\7-Zip")) {
if ($defaultPath === null) {
putenv("PATH=" . getenv("PATH") . ";$installDir7z");
}
Expand Down Expand Up @@ -638,6 +638,7 @@ function install($options)
// Trace
$extensionRealPath = "$tmpArchiveTraceRoot/ext/$extensionVersion/"
. EXTENSION_PREFIX . "ddtrace$extensionSuffix." . EXTENSION_SUFFIX;

if (!file_exists($extensionRealPath)) {
print_error_and_exit(substr($extensionSuffix ?: '-nts', 1)
. ' builds of PHP ' . $phpProperties[PHP_VER] . ' are currently not supported');
Expand Down Expand Up @@ -1506,7 +1507,7 @@ function download($url, $destination, $retry = false)
}
}

curl_close($ch);
if (PHP_VERSION_ID < 80000) { curl_close($ch); }
fclose($fp);

if (false !== $return) {
Expand Down Expand Up @@ -1541,7 +1542,12 @@ function download($url, $destination, $retry = false)
// PHP doesn't like too long location headers, and on PHP 7.3 and older they weren't read at all.
// But this only really matters for CircleCI artifacts, so not too bad.
if ($data == "") {
foreach ($http_response_header as $header) {
if (PHP_VERSION_ID >= 80500) {
$headers = http_get_last_response_headers();
} else {
$headers = $http_response_header;
}
foreach ($headers as $header) {
if (stripos($header, "location: ") === 0) {
$data = file_get_contents(substr($header, 10));
goto got_data;
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ services:
'8.2-bookworm': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-8.2_bookworm-5' }
'8.3-bookworm': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-8.3_bookworm-5' }
'8.4-bookworm': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-8.4_bookworm-5' }
'8.5-bookworm': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-8.5_bookworm-5' }
'php-master-buster': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-master_buster' }
# --- CentOS 6 ---
'7.0-centos7': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-7.0_centos-7' }
Expand All @@ -97,6 +98,7 @@ services:
'8.2-centos7': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-8.2_centos-7' }
'8.3-centos7': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-8.3_centos-7' }
'8.4-centos7': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-8.4_centos-7' }
'8.5-centos7': { <<: *linux_php_service, image: 'datadog/dd-trace-ci:php-8.5_centos-7' }
# --- Windows ---
'7.0-windows': { <<: *windows_php_service, image: 'datadog/dd-trace-ci:php-7.0_windows' }
'7.1-windows': { <<: *windows_php_service, image: 'datadog/dd-trace-ci:php-7.1_windows' }
Expand All @@ -108,6 +110,7 @@ services:
'8.2-windows': { <<: *windows_php_service, image: 'datadog/dd-trace-ci:php-8.2_windows' }
'8.3-windows': { <<: *windows_php_service, image: 'datadog/dd-trace-ci:php-8.3_windows' }
'8.4-windows': { <<: *windows_php_service, image: 'datadog/dd-trace-ci:php-8.4_windows' }
'8.5-windows': { <<: *windows_php_service, image: 'datadog/dd-trace-ci:php-8.5_windows' }

rabbitmq-integration:
image: rabbitmq:3.8.9-alpine # 3.8.9 is the latest version that supports Erlang 20
Expand Down
4 changes: 2 additions & 2 deletions dockerfiles/ci/alpine_compile_extension/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ ENV PHP_API=${phpApi}
ENV PHP_URL=${phpTarGzUrl:-https://www.php.net/distributions/php-${phpVersion}.tar.gz}
ENV PHP_SHA256=${phpSha256Hash}
ENV PHP_SRC_DIR=${SRC_DIR}/php
ENV PHP_INI_DIR /usr/local/etc/php-${phpVersion}
ENV PHP_INI_DIR=/usr/local/etc/php-${phpVersion}
ENV PHP_INSTALL_DIR=/usr/local/php-${phpVersion}

RUN install-php
ENV PATH ${PATH}:${PHP_INSTALL_DIR}/bin
ENV PATH=${PATH}:${PHP_INSTALL_DIR}/bin

ADD ./env-init /root/.bashrc
ENV ENV=/root/.bashrc
Expand Down
13 changes: 13 additions & 0 deletions dockerfiles/ci/alpine_compile_extension/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,16 @@ services:
phpApi: 20240924
volumes:
- ../../:/app

8.5-alpine:
image: datadog/dd-trace-ci:php-compile-extension-alpine-8.5
build:
context: .
x-bake: *bake
args:
phpVersion: 8.5.0
phpTarGzUrl: https://downloads.php.net/~daniels/php-8.5.0RC1.tar.gz
phpSha256Hash: "0ea5059a387117fe6ed9a72cdc20945dbff6acc072df936e97d35a9cb26420e0"
phpApi: 20250925
volumes:
- ../../:/app
59 changes: 45 additions & 14 deletions dockerfiles/ci/bookworm/build-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,49 @@ if [[ $SHARED_BUILD -ne 0 ]]; then
# TODO Add ext/pdo_mysql, ext/pdo_pgsql, and ext/pdo_sqlite
else
pecl channel-update pecl.php.net;

pecl install amqp$AMQP_VERSION; echo "extension=amqp.so" >> ${iniDir}/amqp.ini;
yes '' | pecl install apcu; echo "extension=apcu.so" >> ${iniDir}/apcu.ini;
pecl install ast$AST_VERSION; echo "extension=ast.so" >> ${iniDir}/ast.ini;
if [[ $PHP_VERSION_ID -ge 71 && $PHP_VERSION_ID -le 80 ]]; then
yes '' | CFLAGS="-Wno-incompatible-function-pointer-types" pecl install mcrypt$(if [[ $PHP_VERSION_ID -le 71 ]]; then echo -1.0.0; fi); echo "extension=mcrypt.so" >> ${iniDir}/mcrypt.ini;
fi
yes 'no' | pecl install memcached; echo "extension=memcached.so" >> ${iniDir}/memcached.ini;
yes '' | pecl install memcache$MEMCACHE_VERSION; echo "extension=memcache.so" >> ${iniDir}/memcache.ini;
pecl install mongodb$MONGODB_VERSION; echo "extension=mongodb.so" >> ${iniDir}/mongodb.ini;

if [[ $PHP_VERSION_ID -lt 85 ]]; then
pecl install amqp$AMQP_VERSION; echo "extension=amqp.so" >> "${iniDir}/amqp.ini"
yes 'no' | pecl install memcached; echo "extension=memcached.so" >> ${iniDir}/memcached.ini;
yes '' | pecl install memcache$MEMCACHE_VERSION; echo "extension=memcache.so" >> ${iniDir}/memcache.ini;
pecl install mongodb$MONGODB_VERSION; echo "extension=mongodb.so" >> ${iniDir}/mongodb.ini;

# Xdebug is disabled by default
for VERSION in "${XDEBUG_VERSIONS[@]}"; do
pecl install xdebug$VERSION;
cd $(php-config --extension-dir);
mv xdebug.so xdebug$VERSION.so;
done
else
cd /tmp

# memcached master version
git clone https://github.com/php-memcached-dev/php-memcached.git
cd php-memcached
phpize && ./configure && make -j"$(nproc)" && make install && echo "extension=memcached.so" >> ${iniDir}/memcached.ini;
cd ..

# memcache master version
git clone https://github.com/websupport-sk/pecl-memcache.git
cd pecl-memcache
phpize && ./configure && make -j"$(nproc)" && make install && echo "extension=memcache.so" >> ${iniDir}/memcache.ini;
cd ..

pecl install mongodb$MONGODB_VERSION; echo "extension=mongodb.so" >> ${iniDir}/mongodb.ini;

# Xdebug master version (disabled by default)
git clone https://github.com/xdebug/xdebug.git
cd xdebug
phpize && ./configure && make -j"$(nproc)" && make install;
cd ..
fi
pecl install rdkafka; echo "extension=rdkafka.so" >> ${iniDir}/rdkafka.ini;
pecl install sqlsrv$SQLSRV_VERSION;
# Xdebug is disabled by default
for VERSION in "${XDEBUG_VERSIONS[@]}"; do
pecl install xdebug$VERSION;
cd $(php-config --extension-dir);
mv xdebug.so xdebug$VERSION.so;
done
echo "zend_extension=opcache.so" >> ${iniDir}/../php-apache2handler.ini;

# ext-parallel needs PHP 8 ZTS
Expand All @@ -150,7 +175,7 @@ else
fi

# ext-swoole needs PHP 8
if [[ $PHP_VERSION_ID -ge 80 ]]; then
if [[ $PHP_VERSION_ID -ge 80 && $PHP_VERSION_ID -lt 85 ]]; then
pushd /tmp
if [[ $PHP_VERSION_ID -ge 83 ]]; then
pecl download swoole-6.0.0RC1;
Expand All @@ -169,7 +194,7 @@ else
fi

# ext-grpc is needed for google spanner
if [[ $PHP_VERSION_ID -ge 80 ]]; then
if [[ $PHP_VERSION_ID -ge 80 && $PHP_VERSION_ID -lt 85 ]]; then
pecl install grpc;
# avoid installing it by default, it seems to stall some testsuites.
fi
Expand All @@ -192,7 +217,13 @@ else
fi
fi
if [[ $PHP_VERSION_ID -ge 84 ]]; then
pecl install redis-6.1.0
if [[ $PHP_VERSION_ID -ge 85 ]]; then
git clone https://github.com/phpredis/phpredis.git
cd phpredis
phpize && ./configure && make -j"$(nproc)" && make install
else
pecl install redis-6.1.0
fi
fi

fi
2 changes: 1 addition & 1 deletion dockerfiles/ci/bookworm/build-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ${PHP_SRC_DIR}/configure \
--enable-ftp \
$(if [[ ${PHP_VERSION_ID} -ge 71 ]]; then echo --enable-intl; fi) \
--enable-mbstring \
--enable-opcache \
$(if [[ ${PHP_VERSION_ID} -le 84 ]]; then echo --enable-opcache; fi) \
$(if [[ ${PHP_VERSION_ID} -ge 80 ]]; then echo --enable-zend-test=shared; fi) \
--enable-pcntl \
--enable-soap \
Expand Down
12 changes: 12 additions & 0 deletions dockerfiles/ci/bookworm/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ services:
args: &build-base
BUILD_BASE: datadog/dd-trace-ci:bookworm-$BOOKWORM_NEXT_VERSION

php-8.5:
image: datadog/dd-trace-ci:php-8.5_bookworm-$BOOKWORM_NEXT_VERSION
build:
context: .
dockerfile: php-8.5/Dockerfile
x-bake: *bake
args:
<<: *build-base
phpVersion: "8.5"
phpTarGzUrl: https://downloads.php.net/~daniels/php-8.5.0RC1.tar.gz
phpSha256Hash: "0ea5059a387117fe6ed9a72cdc20945dbff6acc072df936e97d35a9cb26420e0"

php-8.4:
image: datadog/dd-trace-ci:php-8.4_bookworm-$BOOKWORM_NEXT_VERSION
build:
Expand Down
Loading
Loading