Skip to content

Commit

Permalink
Merge branch 'dev' into feat/message_segment
Browse files Browse the repository at this point in the history
  • Loading branch information
zsistla authored Jan 9, 2025
2 parents 925b94c + 8a73dde commit cf172d3
Show file tree
Hide file tree
Showing 171 changed files with 8,688 additions and 277 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/code-coverage-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
matrix:
platform: [gnu, musl]
arch: [amd64]
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
include:
- codecov: 0
- platform: gnu
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
matrix:
platform: [gnu, musl]
arch: [amd64]
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
include:
- codecov: 0
- platform: gnu
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
matrix:
platform: [gnu, musl]
php: ['8.0', '8.1', '8.2', '8.3']
php: ['8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
fail-fast: true
matrix:
platform: [gnu, musl]
php: ['8.0', '8.1', '8.2', '8.3']
php: ['8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout integration tests
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ jobs:
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/upload-sarif@v3
with:
checkout_path: ./php-agent
sarif_file: trivy-results.sarif
4 changes: 2 additions & 2 deletions .github/workflows/test-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
matrix:
platform: [gnu, musl]
arch: [amd64, arm64]
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
exclude:
- arch: arm64
php: '7.2'
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
matrix:
platform: [gnu, musl]
arch: [amd64, arm64]
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
exclude:
- arch: arm64
php: '7.2'
Expand Down
5 changes: 4 additions & 1 deletion agent/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,16 @@ if test "$PHP_NEWRELIC" = "yes"; then
lib_guzzle4.c lib_guzzle6.c lib_guzzle_common.c \
lib_mongodb.c lib_phpunit.c lib_predis.c lib_zend_http.c \
lib_composer.c"
PHP_NEW_EXTENSION(newrelic, $FRAMEWORKS $LIBRARIES $NEWRELIC_AGENT, $ext_shared,, \\$(NEWRELIC_CFLAGS))
PHP_NEW_EXTENSION(newrelic, $FRAMEWORKS $LIBRARIES $NEWRELIC_AGENT, $ext_shared,, $(NEWRELIC_CFLAGS))

PHP_SUBST(NEWRELIC_CFLAGS)

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

dnl Make sure we include the source directory in the include search path.
PHP_ADD_INCLUDE([$abs_srcdir], [1])

dnl Include the Makefile.frag, which we use to handle build time
dnl dependencies.
PHP_ADD_MAKEFILE_FRAGMENT
Expand Down
15 changes: 12 additions & 3 deletions agent/newrelic-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,10 @@ for pmv in "20170718" "20180731" "20190902"; do
done
fi
# Currently supported versions:
# (8.0, 8.1, 8.2, 8.3)
# (8.0, 8.1, 8.2, 8.3, 8.4)
# for x64 and aarch64
if [ ${arch} = x64 ] || [ ${arch} = aarch64 ]; then
for pmv in "20200930" "20210902" "20220829" "20230831"; do
for pmv in "20200930" "20210902" "20220829" "20230831" "20240924"; do
check_file "${ilibdir}/agent/${arch}/newrelic-${pmv}.so"
done
fi
Expand Down Expand Up @@ -542,6 +542,7 @@ add_to_path /usr/local/php-8.0/bin
add_to_path /usr/local/php-8.1/bin
add_to_path /usr/local/php-8.2/bin
add_to_path /usr/local/php-8.3/bin
add_to_path /usr/local/php-8.4/bin

add_to_path /opt/local/bin
add_to_path /usr/php/bin
Expand All @@ -553,6 +554,7 @@ add_to_path /usr/php-8.0/bin
add_to_path /usr/php-8.1/bin
add_to_path /usr/php-8.2/bin
add_to_path /usr/php-8.3/bin
add_to_path /usr/php-8.4/bin

add_to_path /usr/php/7.2/bin
add_to_path /usr/php/7.3/bin
Expand All @@ -561,6 +563,7 @@ add_to_path /usr/php/8.0/bin
add_to_path /usr/php/8.1/bin
add_to_path /usr/php/8.2/bin
add_to_path /usr/php/8.3/bin
add_to_path /usr/php/8.4/bin

add_to_path /opt/php/bin
add_to_path /opt/zend/bin
Expand All @@ -572,6 +575,7 @@ add_to_path /opt/php-8.0/bin
add_to_path /opt/php-8.1/bin
add_to_path /opt/php-8.2/bin
add_to_path /opt/php-8.3/bin
add_to_path /opt/php-8.4/bin

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

8.3.*)
pi_php8="yes"
;;
;;

8.4.*)
pi_php8="yes"
;;

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

Expand Down
1 change: 1 addition & 0 deletions agent/php_includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define ZEND_8_1_X_API_NO 20210902
#define ZEND_8_2_X_API_NO 20220829
#define ZEND_8_3_X_API_NO 20230831
#define ZEND_8_4_X_API_NO 20240924

#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO /* PHP8+ */
#include "Zend/zend_observer.h"
Expand Down
28 changes: 28 additions & 0 deletions agent/php_internal_instrument.c
Original file line number Diff line number Diff line change
Expand Up @@ -3840,9 +3840,37 @@ void nr_php_generate_internal_wrap_records(void) {
NR_INTERNAL_WRAPREC("sqlite3::exec", sqlite3_exec, sqlite3, 0, 0)

NR_INTERNAL_WRAPREC("pdo::__construct", pdo_construct, pdo_construct, 0, 0)
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO
NR_INTERNAL_WRAPREC("pdo\\firebird::__construct", pdo_construct, pdo_construct, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\mysql::__construct", pdo_construct, pdo_construct, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\odbc::__construct", pdo_construct, pdo_construct, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\pgsql::__construct", pdo_construct, pdo_construct, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\sqlite::__construct", pdo_construct, pdo_construct, 0, 0)
#endif
NR_INTERNAL_WRAPREC("pdo::query", pdo_query, pdo_query, 0, 0)
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO
NR_INTERNAL_WRAPREC("pdo\\firebird::query", pdo_query, pdo_query, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\mysql::query", pdo_query, pdo_query, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\odbc::query", pdo_query, pdo_query, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\pgsql::query", pdo_query, pdo_query, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\sqlite::query", pdo_query, pdo_query, 0, 0)
#endif
NR_INTERNAL_WRAPREC("pdo::exec", pdo_exec, pdo_exec, 0, 0)
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO
NR_INTERNAL_WRAPREC("pdo\\firebird::exec", pdo_exec, pdo_exec, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\mysql::exec", pdo_exec, pdo_exec, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\odbc::exec", pdo_exec, pdo_exec, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\pgsql::exec", pdo_exec, pdo_exec, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\sqlite::exec", pdo_exec, pdo_exec, 0, 0)
#endif
NR_INTERNAL_WRAPREC("pdo::prepare", pdo_prepare, pdo_prepare, 0, 0)
#if ZEND_MODULE_API_NO >= ZEND_8_4_X_API_NO
NR_INTERNAL_WRAPREC("pdo\\firebird::prepare", pdo_prepare, pdo_prepare, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\mysql::prepare", pdo_prepare, pdo_prepare, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\odbc::prepare", pdo_prepare, pdo_prepare, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\pgsql::prepare", pdo_prepare, pdo_prepare, 0, 0)
NR_INTERNAL_WRAPREC("pdo\\sqlite::prepare", pdo_prepare, pdo_prepare, 0, 0)
#endif
NR_INTERNAL_WRAPREC("pdostatement::execute", pdostmt_execute,
pdostatement_execute, 0, 0)

Expand Down
4 changes: 4 additions & 0 deletions agent/tests/test_agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ static void test_function_debug_name(TSRMLS_D) {
func = nr_php_zval_to_function(closure TSRMLS_CC);
name = nr_php_function_debug_name(func);

#if ZEND_MODULE_API_NO < ZEND_8_4_X_API_NO
tlib_pass_if_str_equal("closure", "{closure} declared at -:1", name);
#else
tlib_pass_if_str_equal("closure", "{closure:-:1} declared at -:1", name);
#endif

nr_php_zval_free(&closure);
nr_free(name);
Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ _(most operating systems package these with `-dev` or `-devel` suffixes)_

### PHP

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

## Build the PHP Agent

Expand Down
4 changes: 2 additions & 2 deletions files/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

ARG PHP_VER

FROM php:${PHP_VER:-8.3}
FROM php:${PHP_VER:-8.4}

RUN docker-php-source extract

Expand Down Expand Up @@ -89,7 +89,7 @@ COPY --from=composer ["/usr/bin/composer", "/usr/bin/composer"]
# and 8.0 has problems with how the explanation for informational_schema
# work (refer to bug https://bugs.mysql.com/bug.php?id=102536) so to run
# the mysql tests a separate machine running mysql server 5.6 is required.
RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install pdo pdo_mysql pdo_pgsql

# install redis extension required by test_redis:
RUN \
Expand Down
2 changes: 1 addition & 1 deletion make/php_versions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# SPDX-License-Identifier: Apache-2.0
#

PHP_VERSION_LIST=$${PHPS:-8.3 8.2 8.1 8.0 7.4 7.3 7.2}
PHP_VERSION_LIST=$${PHPS:-8.4 8.3 8.2 8.1 8.0 7.4 7.3 7.2}
1 change: 1 addition & 0 deletions make/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ release-$1-zts: Makefile agent | releases/$$(RELEASE_OS)/agent/$$(RELEASE_ARCH)/

endef

$(eval $(call RELEASE_AGENT_TARGET,8.4,20240924))
$(eval $(call RELEASE_AGENT_TARGET,8.3,20230831))
$(eval $(call RELEASE_AGENT_TARGET,8.2,20220829))
$(eval $(call RELEASE_AGENT_TARGET,8.1,20210902))
Expand Down
6 changes: 5 additions & 1 deletion tests/include/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function isset_or($check, $alternate = NULL)

$MYSQL_USER = isset_or('MYSQL_USER', 'root');
$MYSQL_PASSWD = isset_or('MYSQL_PASSWD', 'root');
$MYSQL_DB = 'information_schema'; // TODO: MSL comment here.
$MYSQL_DB = isset_or('MYSQL_DB', 'information_schema');
$MYSQL_HOST = isset_or('MYSQL_HOST', 'localhost');
$MYSQL_PORT = isset_or('MYSQL_PORT', 3306);
$MYSQL_SOCKET = isset_or('MYSQL_SOCKET', '');
Expand Down Expand Up @@ -75,6 +75,10 @@ function make_tracing_url($file)
$PG_PORT = isset_or('PG_PORT', '5433');
$PG_CONNECTION = "host=$PG_HOST port=$PG_PORT user=$PG_USER password=$PG_PW connect_timeout=1";

$PDO_PGSQL_DSN = 'pgsql:';
$PDO_PGSQL_DSN .= 'host=' . $PG_HOST . ';';
$PDO_PGSQL_DSN .= 'port=' . $PG_PORT . ';';

// Header used to track whether or not our CAT instrumentation interferes with
// other existing headers.
define('CUSTOMER_HEADER', 'Customer-Header');
Expand Down
Binary file modified tests/include/guzzle.tar.bz2
Binary file not shown.
Binary file modified tests/include/monolog2.tar.bz2
Binary file not shown.
Binary file modified tests/include/monolog3.tar.bz2
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
Tests newrelic_set_error_group_callback() API for Web errors.
*/

/*SKIPIF
<?php
if (version_compare(PHP_VERSION, "8.4", ">=")) {
die("skip: newer test for PHPs 8.4+\n");
}
*/


/*ENVIRONMENT
REQUEST_METHOD=GET
QUERY_STRING=foo=1&bar=2
Expand Down
Loading

0 comments on commit cf172d3

Please sign in to comment.