Skip to content

Commit 34d720e

Browse files
ZNeumannwillitscalelavarou
authored
feat: PHP 8.4 (#996)
Bumps monolog and guzzle versions for 8.4 support from those libraries. monolog2 -> 2.10 monolog3 -> 3.8 guzzle -> 7.9.2 Adds 8.4 to builds/tests/installers. Requires some updates to our make/configure scripts to adapt to changes in PHP autoconf macros. Adjusts tests to account for new closure naming in PHP 8.4 Adjusts tests to account for deprecation of E_USER_ERROR --------- Co-authored-by: James <[email protected]> Co-authored-by: Michal Nowacki <[email protected]>
1 parent f26aead commit 34d720e

File tree

167 files changed

+8595
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+8595
-277
lines changed

.github/workflows/code-coverage-baseline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
matrix:
7070
platform: [gnu, musl]
7171
arch: [amd64]
72-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
72+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
7373
include:
7474
- codecov: 0
7575
- platform: gnu
@@ -147,7 +147,7 @@ jobs:
147147
matrix:
148148
platform: [gnu, musl]
149149
arch: [amd64]
150-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
150+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
151151
include:
152152
- codecov: 0
153153
- platform: gnu

.github/workflows/make-agent.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
strategy:
3333
matrix:
3434
platform: [gnu, musl]
35-
php: ['8.0', '8.1', '8.2', '8.3']
35+
php: ['8.0', '8.1', '8.2', '8.3', '8.4']
3636
steps:
3737
- name: Checkout Repo
3838
uses: actions/checkout@v4

.github/workflows/make-integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
fail-fast: true
3535
matrix:
3636
platform: [gnu, musl]
37-
php: ['8.0', '8.1', '8.2', '8.3']
37+
php: ['8.0', '8.1', '8.2', '8.3', '8.4']
3838
steps:
3939
- name: Checkout integration tests
4040
uses: actions/checkout@v4

.github/workflows/test-agent.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
matrix:
9898
platform: [gnu, musl]
9999
arch: [amd64, arm64]
100-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
100+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
101101
exclude:
102102
- arch: arm64
103103
php: '7.2'
@@ -203,7 +203,7 @@ jobs:
203203
matrix:
204204
platform: [gnu, musl]
205205
arch: [amd64, arm64]
206-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
206+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
207207
exclude:
208208
- arch: arm64
209209
php: '7.2'

agent/config.m4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,16 @@ if test "$PHP_NEWRELIC" = "yes"; then
232232
lib_guzzle4.c lib_guzzle6.c lib_guzzle_common.c \
233233
lib_mongodb.c lib_phpunit.c lib_predis.c lib_zend_http.c \
234234
lib_composer.c"
235-
PHP_NEW_EXTENSION(newrelic, $FRAMEWORKS $LIBRARIES $NEWRELIC_AGENT, $ext_shared,, \\$(NEWRELIC_CFLAGS))
235+
PHP_NEW_EXTENSION(newrelic, $FRAMEWORKS $LIBRARIES $NEWRELIC_AGENT, $ext_shared,, $(NEWRELIC_CFLAGS))
236236

237237
PHP_SUBST(NEWRELIC_CFLAGS)
238238

239239
dnl Define $(PHP_CONFIG) so we can call it when building tests.
240240
PHP_SUBST(PHP_CONFIG)
241241

242+
dnl Make sure we include the source directory in the include search path.
243+
PHP_ADD_INCLUDE([$abs_srcdir], [1])
244+
242245
dnl Include the Makefile.frag, which we use to handle build time
243246
dnl dependencies.
244247
PHP_ADD_MAKEFILE_FRAGMENT

agent/newrelic-install.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,10 @@ for pmv in "20170718" "20180731" "20190902"; do
335335
done
336336
fi
337337
# Currently supported versions:
338-
# (8.0, 8.1, 8.2, 8.3)
338+
# (8.0, 8.1, 8.2, 8.3, 8.4)
339339
# for x64 and aarch64
340340
if [ ${arch} = x64 ] || [ ${arch} = aarch64 ]; then
341-
for pmv in "20200930" "20210902" "20220829" "20230831"; do
341+
for pmv in "20200930" "20210902" "20220829" "20230831" "20240924"; do
342342
check_file "${ilibdir}/agent/${arch}/newrelic-${pmv}.so"
343343
done
344344
fi
@@ -542,6 +542,7 @@ add_to_path /usr/local/php-8.0/bin
542542
add_to_path /usr/local/php-8.1/bin
543543
add_to_path /usr/local/php-8.2/bin
544544
add_to_path /usr/local/php-8.3/bin
545+
add_to_path /usr/local/php-8.4/bin
545546

546547
add_to_path /opt/local/bin
547548
add_to_path /usr/php/bin
@@ -553,6 +554,7 @@ add_to_path /usr/php-8.0/bin
553554
add_to_path /usr/php-8.1/bin
554555
add_to_path /usr/php-8.2/bin
555556
add_to_path /usr/php-8.3/bin
557+
add_to_path /usr/php-8.4/bin
556558

557559
add_to_path /usr/php/7.2/bin
558560
add_to_path /usr/php/7.3/bin
@@ -561,6 +563,7 @@ add_to_path /usr/php/8.0/bin
561563
add_to_path /usr/php/8.1/bin
562564
add_to_path /usr/php/8.2/bin
563565
add_to_path /usr/php/8.3/bin
566+
add_to_path /usr/php/8.4/bin
564567

565568
add_to_path /opt/php/bin
566569
add_to_path /opt/zend/bin
@@ -572,6 +575,7 @@ add_to_path /opt/php-8.0/bin
572575
add_to_path /opt/php-8.1/bin
573576
add_to_path /opt/php-8.2/bin
574577
add_to_path /opt/php-8.3/bin
578+
add_to_path /opt/php-8.4/bin
575579

576580
if [ -n "${NR_INSTALL_PATH}" ]; then
577581
oIFS="${IFS}"
@@ -1052,7 +1056,11 @@ for this copy of PHP. We apologize for the inconvenience.
10521056

10531057
8.3.*)
10541058
pi_php8="yes"
1055-
;;
1059+
;;
1060+
1061+
8.4.*)
1062+
pi_php8="yes"
1063+
;;
10561064

10571065
*)
10581066
error "unsupported version '${pi_ver}' of PHP found at:
@@ -1232,6 +1240,7 @@ does not exist. This particular instance of PHP will be skipped.
12321240
8.1.*) pi_modver="20210902" ;;
12331241
8.2.*) pi_modver="20220829" ;;
12341242
8.3.*) pi_modver="20230831" ;;
1243+
8.4.*) pi_modver="20240924" ;;
12351244
esac
12361245
log "${pdir}: pi_modver=${pi_modver}"
12371246

agent/php_includes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#define ZEND_8_1_X_API_NO 20210902
5555
#define ZEND_8_2_X_API_NO 20220829
5656
#define ZEND_8_3_X_API_NO 20230831
57+
#define ZEND_8_4_X_API_NO 20240924
5758

5859
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO /* PHP8+ */
5960
#include "Zend/zend_observer.h"

agent/php_internal_instrument.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3840,9 +3840,37 @@ void nr_php_generate_internal_wrap_records(void) {
38403840
NR_INTERNAL_WRAPREC("sqlite3::exec", sqlite3_exec, sqlite3, 0, 0)
38413841

38423842
NR_INTERNAL_WRAPREC("pdo::__construct", pdo_construct, pdo_construct, 0, 0)
3843+
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO
3844+
NR_INTERNAL_WRAPREC("pdo\\firebird::__construct", pdo_construct, pdo_construct, 0, 0)
3845+
NR_INTERNAL_WRAPREC("pdo\\mysql::__construct", pdo_construct, pdo_construct, 0, 0)
3846+
NR_INTERNAL_WRAPREC("pdo\\odbc::__construct", pdo_construct, pdo_construct, 0, 0)
3847+
NR_INTERNAL_WRAPREC("pdo\\pgsql::__construct", pdo_construct, pdo_construct, 0, 0)
3848+
NR_INTERNAL_WRAPREC("pdo\\sqlite::__construct", pdo_construct, pdo_construct, 0, 0)
3849+
#endif
38433850
NR_INTERNAL_WRAPREC("pdo::query", pdo_query, pdo_query, 0, 0)
3851+
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO
3852+
NR_INTERNAL_WRAPREC("pdo\\firebird::query", pdo_query, pdo_query, 0, 0)
3853+
NR_INTERNAL_WRAPREC("pdo\\mysql::query", pdo_query, pdo_query, 0, 0)
3854+
NR_INTERNAL_WRAPREC("pdo\\odbc::query", pdo_query, pdo_query, 0, 0)
3855+
NR_INTERNAL_WRAPREC("pdo\\pgsql::query", pdo_query, pdo_query, 0, 0)
3856+
NR_INTERNAL_WRAPREC("pdo\\sqlite::query", pdo_query, pdo_query, 0, 0)
3857+
#endif
38443858
NR_INTERNAL_WRAPREC("pdo::exec", pdo_exec, pdo_exec, 0, 0)
3859+
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO
3860+
NR_INTERNAL_WRAPREC("pdo\\firebird::exec", pdo_exec, pdo_exec, 0, 0)
3861+
NR_INTERNAL_WRAPREC("pdo\\mysql::exec", pdo_exec, pdo_exec, 0, 0)
3862+
NR_INTERNAL_WRAPREC("pdo\\odbc::exec", pdo_exec, pdo_exec, 0, 0)
3863+
NR_INTERNAL_WRAPREC("pdo\\pgsql::exec", pdo_exec, pdo_exec, 0, 0)
3864+
NR_INTERNAL_WRAPREC("pdo\\sqlite::exec", pdo_exec, pdo_exec, 0, 0)
3865+
#endif
38453866
NR_INTERNAL_WRAPREC("pdo::prepare", pdo_prepare, pdo_prepare, 0, 0)
3867+
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO
3868+
NR_INTERNAL_WRAPREC("pdo\\firebird::prepare", pdo_prepare, pdo_prepare, 0, 0)
3869+
NR_INTERNAL_WRAPREC("pdo\\mysql::prepare", pdo_prepare, pdo_prepare, 0, 0)
3870+
NR_INTERNAL_WRAPREC("pdo\\odbc::prepare", pdo_prepare, pdo_prepare, 0, 0)
3871+
NR_INTERNAL_WRAPREC("pdo\\pgsql::prepare", pdo_prepare, pdo_prepare, 0, 0)
3872+
NR_INTERNAL_WRAPREC("pdo\\sqlite::prepare", pdo_prepare, pdo_prepare, 0, 0)
3873+
#endif
38463874
NR_INTERNAL_WRAPREC("pdostatement::execute", pdostmt_execute,
38473875
pdostatement_execute, 0, 0)
38483876

agent/tests/test_agent.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ static void test_function_debug_name(TSRMLS_D) {
142142
func = nr_php_zval_to_function(closure TSRMLS_CC);
143143
name = nr_php_function_debug_name(func);
144144

145+
#if ZEND_MODULE_API_NO < ZEND_8_4_X_API_NO
145146
tlib_pass_if_str_equal("closure", "{closure} declared at -:1", name);
147+
#else
148+
tlib_pass_if_str_equal("closure", "{closure:-:1} declared at -:1", name);
149+
#endif
146150

147151
nr_php_zval_free(&closure);
148152
nr_free(name);

docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ _(most operating systems package these with `-dev` or `-devel` suffixes)_
5858

5959
### PHP
6060

61-
The PHP agent supports PHP versions `7.2`, `7.3`, `7.4`,`8.0`, `8.1`, '8.2', and `8.3`.
61+
The PHP agent supports PHP versions `7.2`, `7.3`, `7.4`,`8.0`, `8.1`, `8.2`, `8.3` and `8.4`.
6262

6363
## Build the PHP Agent
6464

0 commit comments

Comments
 (0)