Skip to content

Commit b3468ef

Browse files
committed
Improve 8.5 support
1 parent 7144bc2 commit b3468ef

File tree

4 files changed

+35
-16
lines changed

4 files changed

+35
-16
lines changed

appsec/run-tests-internal.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -845,19 +845,19 @@ function write_information()
845845
$info_params = array();
846846
settings2array($ini_overwrites, $info_params);
847847
$info_params = settings2params($info_params);
848-
$php_info = `$php $pass_options $info_params $no_file_cache "$info_file"`;
849-
define('TESTED_PHP_VERSION', `$php -n -r "echo PHP_VERSION;"`);
848+
$php_info = shell_exec("$php $pass_options $info_params $no_file_cache \"$info_file\"");
849+
define('TESTED_PHP_VERSION', shell_exec("$php -n -r \"echo PHP_VERSION;\""));
850850

851851
if ($php_cgi && $php != $php_cgi) {
852-
$php_info_cgi = `$php_cgi $pass_options $info_params $no_file_cache -q "$info_file"`;
852+
$php_info_cgi = shell_exec("$php_cgi $pass_options $info_params $no_file_cache -q \"$info_file\"");
853853
$php_info_sep = "\n---------------------------------------------------------------------";
854854
$php_cgi_info = "$php_info_sep\nPHP : $php_cgi $php_info_cgi$php_info_sep";
855855
} else {
856856
$php_cgi_info = '';
857857
}
858858

859859
if ($phpdbg) {
860-
$phpdbg_info = `$phpdbg $pass_options $info_params $no_file_cache -qrr "$info_file"`;
860+
$phpdbg_info = shell_exec("$phpdbg $pass_options $info_params $no_file_cache -qrr \"$info_file\"");
861861
$php_info_sep = "\n---------------------------------------------------------------------";
862862
$phpdbg_info = "$php_info_sep\nPHP : $phpdbg $phpdbg_info$php_info_sep";
863863
} else {
@@ -872,7 +872,7 @@ function write_information()
872872
// load list of enabled extensions
873873
save_text($info_file,
874874
'<?php echo str_replace("Zend OPcache", "opcache", implode(",", get_loaded_extensions())); ?>');
875-
$exts_to_test = explode(',', `$php $pass_options $info_params $no_file_cache "$info_file"`);
875+
$exts_to_test = explode(',', shell_exec("$php $pass_options $info_params $no_file_cache \"$info_file\""));
876876
// check for extensions that need special handling and regenerate
877877
$info_params_ex = array(
878878
'session' => array('session.auto_start=0'),
@@ -2171,9 +2171,9 @@ function run_test($php, $file, array $env)
21712171
$ext_params = array();
21722172
settings2array($ini_overwrites, $ext_params);
21732173
$ext_params = settings2params($ext_params);
2174-
$ext_dir = `$php $pass_options $extra_options $ext_params $no_file_cache -d display_errors=0 -r "echo ini_get('extension_dir');"`;
2174+
$ext_dir = shell_exec("$php $pass_options $extra_options $ext_params $no_file_cache -d display_errors=0 -r \"echo ini_get('extension_dir');\"");
21752175
$extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS']));
2176-
$loaded = explode(",", `$php $pass_options $extra_options $ext_params $no_file_cache -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`);
2176+
$loaded = explode(",", shell_exec("$php $pass_options $extra_options $ext_params $no_file_cache -d display_errors=0 -r \"echo implode(',', get_loaded_extensions());\""));
21772177
$ext_prefix = IS_WINDOWS ? "php_" : "";
21782178
foreach ($extensions as $req_ext) {
21792179
if (!in_array($req_ext, $loaded)) {
@@ -3403,7 +3403,7 @@ function show_result(
34033403
$tested,
34043404
$tested_file,
34053405
$extra = '',
3406-
array $temp_filenames = null
3406+
$temp_filenames = null
34073407
) {
34083408
global $SHOW_ONLY_GROUPS, $colorize;
34093409

appsec/tests/extension/module_order_opcache.phpt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
Verify ddappsec is always in the module registry after ddtrace when opcache is present
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded('Zend OPcache')) {
6-
die('skip requires opcache');
7-
}
8-
if (!version_compare(PHP_VERSION, '8.5.0', '>='))
5+
if (version_compare(PHP_VERSION, '8.5.0', '>='))
96
die('skip: opcache is loaded by default in PHP 8.5+');
107
?>
118
--INI--
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Verify ddappsec is always in the module registry after ddtrace when opcache is present
3+
--SKIPIF--
4+
<?php
5+
if (version_compare(PHP_VERSION, '8.5.0', '<')) {
6+
die('skip: opcache is loaded by default only in PHP 8.5+');
7+
}
8+
?>
9+
--INI--
10+
extension=ddtrace.so
11+
--FILE--
12+
<?php
13+
foreach (get_loaded_extensions() as &$ext) {
14+
if ($ext == 'ddappsec' || $ext == 'ddtrace') {
15+
printf("%s\n", $ext);
16+
}
17+
}
18+
?>
19+
--EXPECTF--
20+
ddtrace
21+
ddappsec

appsec/tests/integration/src/docker/php/build_dev_php.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ function download_php {
3636
local download_url
3737
if [[ $version_id -lt 50400 ]]; then
3838
download_url="http://museum.php.net/php5/php-${version}.tar.gz"
39-
elif [[ $version_id -ge 80500 ]]; then
40-
download_url="https://downloads.php.net/~daniels/php-8.5.0RC3.tar.gz"
4139
else
4240
download_url="https://www.php.net/distributions/php-${version}.tar.gz"
4341
fi
@@ -109,7 +107,7 @@ function get_xdebug_version {
109107
elif [[ $version_id -lt 80400 ]]; then
110108
echo '3.3.2'
111109
elif [[ $version_id -ge 80400 ]]; then
112-
echo '3.4.0'
110+
echo '3.5.0'
113111
fi
114112
}
115113

@@ -199,7 +197,6 @@ function build_php {
199197
--enable-filter
200198
--enable-intl=shared
201199
--enable-mbstring=shared
202-
--enable-opcache=shared
203200
"--enable-pdo=$([[ $(uname -o) != Darwin ]] && echo shared)"
204201
--enable-phar=shared
205202
--enable-xml
@@ -226,6 +223,10 @@ function build_php {
226223
options+=(--enable-json) # not shared to make it consistent with php 8
227224
fi
228225

226+
if [[ $version_id -lt 85000 ]]; then
227+
options+=(--enable-opcache=shared)
228+
fi
229+
229230
if [[ $minimal -eq 0 ]]; then
230231
local mysql_config= mysql_prefix=
231232
if contains_element nomysqlnd "${variants[@]}"; then

0 commit comments

Comments
 (0)