diff --git a/.github/workflows/code-coverage-baseline.yml b/.github/workflows/code-coverage-baseline.yml index ab5b213f8..199bdccac 100644 --- a/.github/workflows/code-coverage-baseline.yml +++ b/.github/workflows/code-coverage-baseline.yml @@ -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 @@ -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 diff --git a/.github/workflows/make-agent.yml b/.github/workflows/make-agent.yml index b29881676..6508fcaf3 100644 --- a/.github/workflows/make-agent.yml +++ b/.github/workflows/make-agent.yml @@ -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 diff --git a/.github/workflows/make-integration-tests.yml b/.github/workflows/make-integration-tests.yml index 800146f41..0b6660575 100644 --- a/.github/workflows/make-integration-tests.yml +++ b/.github/workflows/make-integration-tests.yml @@ -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 diff --git a/.github/workflows/test-agent.yml b/.github/workflows/test-agent.yml index 328be3a39..fff60dae5 100644 --- a/.github/workflows/test-agent.yml +++ b/.github/workflows/test-agent.yml @@ -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' @@ -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' diff --git a/agent/config.m4 b/agent/config.m4 index 5806caac5..6671bcd54 100644 --- a/agent/config.m4 +++ b/agent/config.m4 @@ -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 diff --git a/agent/newrelic-install.sh b/agent/newrelic-install.sh index 9ef1e45fd..8ff9cd3ed 100755 --- a/agent/newrelic-install.sh +++ b/agent/newrelic-install.sh @@ -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 @@ -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 @@ -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 @@ -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 @@ -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}" @@ -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: @@ -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}" diff --git a/agent/php_includes.h b/agent/php_includes.h index 72c25a26a..da255fdbc 100644 --- a/agent/php_includes.h +++ b/agent/php_includes.h @@ -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" diff --git a/agent/php_internal_instrument.c b/agent/php_internal_instrument.c index ce6c089ec..e37510e32 100644 --- a/agent/php_internal_instrument.c +++ b/agent/php_internal_instrument.c @@ -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) diff --git a/agent/tests/test_agent.c b/agent/tests/test_agent.c index 12d3437e4..53b3495ee 100644 --- a/agent/tests/test_agent.c +++ b/agent/tests/test_agent.c @@ -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); diff --git a/docs/development.md b/docs/development.md index 11700cdee..ec42de64d 100644 --- a/docs/development.md +++ b/docs/development.md @@ -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 diff --git a/files/Dockerfile b/files/Dockerfile index cb52536ef..2f99740e3 100644 --- a/files/Dockerfile +++ b/files/Dockerfile @@ -9,7 +9,7 @@ ARG PHP_VER -FROM php:${PHP_VER:-8.3} +FROM php:${PHP_VER:-8.4} RUN docker-php-source extract @@ -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 \ diff --git a/make/php_versions.mk b/make/php_versions.mk index e0a63e9b9..f28157f09 100644 --- a/make/php_versions.mk +++ b/make/php_versions.mk @@ -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} diff --git a/make/release.mk b/make/release.mk index 8eee97388..bb166f66e 100644 --- a/make/release.mk +++ b/make/release.mk @@ -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)) diff --git a/tests/include/config.php b/tests/include/config.php index 4cde7cfb2..399d15552 100644 --- a/tests/include/config.php +++ b/tests/include/config.php @@ -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', ''); @@ -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'); diff --git a/tests/include/guzzle.tar.bz2 b/tests/include/guzzle.tar.bz2 index 49e7b4ef2..a7ecfeb72 100644 Binary files a/tests/include/guzzle.tar.bz2 and b/tests/include/guzzle.tar.bz2 differ diff --git a/tests/include/monolog2.tar.bz2 b/tests/include/monolog2.tar.bz2 index 2b97f8938..a1c0578e4 100644 Binary files a/tests/include/monolog2.tar.bz2 and b/tests/include/monolog2.tar.bz2 differ diff --git a/tests/include/monolog3.tar.bz2 b/tests/include/monolog3.tar.bz2 index 2cce31210..783c067d6 100644 Binary files a/tests/include/monolog3.tar.bz2 and b/tests/include/monolog3.tar.bz2 differ diff --git a/tests/integration/api/error_group_callback/test_error_group_callback_error_web.php b/tests/integration/api/error_group_callback/test_error_group_callback_error_web.php index c4c02c418..3b82e16f9 100644 --- a/tests/integration/api/error_group_callback/test_error_group_callback_error_web.php +++ b/tests/integration/api/error_group_callback/test_error_group_callback_error_web.php @@ -8,6 +8,14 @@ Tests newrelic_set_error_group_callback() API for Web errors. */ +/*SKIPIF +=")) { + die("skip: newer test for PHPs 8.4+\n"); +} +*/ + + /*ENVIRONMENT REQUEST_METHOD=GET QUERY_STRING=foo=1&bar=2 diff --git a/tests/integration/api/error_group_callback/test_error_group_callback_error_web.php84.php b/tests/integration/api/error_group_callback/test_error_group_callback_error_web.php84.php new file mode 100644 index 000000000..e740c7613 --- /dev/null +++ b/tests/integration/api/error_group_callback/test_error_group_callback_error_web.php84.php @@ -0,0 +1,179 @@ + \/test_error_group_callback_error_web.php84.php\?foo=1&bar=2 +path => .*test_error_group_callback_error_web.php84.php +method => GET +status_code => 200 + +klass => E_USER_WARNING +message => I'M COVERED IN BEES +file => .*test_error_group_callback_error_web.php84.php +stack => \[" in trigger_error called at .*test_error_group_callback_error_web.php84.php \(.*\)"," in alpha called at .*test_error_group_callback_error_web.php84.php \(.*\)"\] +*/ + +/*EXPECT_METRICS +[ + "?? agent run id", + "?? timeframe start", + "?? timeframe stop", + [ + [{"name":"Apdex"}, [0, "??", "??", "??", "??", "??"]], + [{"name":"Apdex/Uri__FILE__"}, [0, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"DurationByCaller/Unknown/Unknown/Unknown/Unknown/allWeb"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"Errors/WebTransaction/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"Errors/all"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"Errors/allWeb"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"ErrorsByCaller/Unknown/Unknown/Unknown/Unknown/allWeb"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"HttpDispatcher"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"Supportability/api/set_error_group_callback"}, [1, 0, 0, 0, 0, 0]], + [{"name":"WebTransaction"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"WebTransaction/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"WebTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"WebTransactionTotalTime/Uri__FILE__"}, [1, "??", "??", "??", "??", "??"]], + [{"name":"Supportability/Logging/LocalDecorating/PHP/disabled"}, [1, "??", "??", "??", "??", "??"]] + ] +] +*/ + + +/*EXPECT_ERROR_EVENTS +[ + "?? agent run id", + { + "reservoir_size": 100, + "events_seen": 1 + }, + [ + [ + { + "type": "TransactionError", + "timestamp": "??", + "error.class": "E_USER_WARNING", + "error.message": "I'M COVERED IN BEES", + "transactionName": "WebTransaction\/Uri__FILE__", + "duration": "??", + "nr.transactionGuid": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??", + "spanId": "??" + }, + {}, + { + "response.headers.contentType": "application\/json", + "http.statusCode": 200, + "response.statusCode": 200, + "httpResponseCode": "200", + "request.uri": "__FILE__", + "error.group.name": "CUSTOM ERROR GROUP NAME", + "SERVER_NAME": "127.0.0.1", + "request.method": "GET", + "request.headers.host": "127.0.0.1" + } + ] + ] +] +*/ + +/*EXPECT_TRACED_ERRORS +[ + "?? agent run id", + [ + [ + "??", + "WebTransaction\/Uri__FILE__", + "I'M COVERED IN BEES", + "E_USER_WARNING", + { + "stack_trace": [ + " in trigger_error called at __FILE__ (??)", + " in alpha called at __FILE__ (??)" + ], + "agentAttributes": { + "response.headers.contentType": "application\/json", + "http.statusCode": 200, + "response.statusCode": 200, + "httpResponseCode": "200", + "request.uri": "__FILE__", + "error.group.name": "CUSTOM ERROR GROUP NAME", + "SERVER_NAME": "127.0.0.1", + "request.method": "GET", + "request.headers.host": "127.0.0.1" + }, + "intrinsics": { + "totalTime": "??", + "cpu_time": "??", + "cpu_user_time": "??", + "cpu_sys_time": "??", + "guid": "??", + "sampled": true, + "priority": "??", + "traceId": "??" + }, + "request_uri": "__FILE__" + }, + "?? transaction ID" + ] + ] +] +*/ + +require_once(realpath(dirname(__FILE__)) . '/../../../include/tap.php'); + +header('Content-Type: text/html'); +header('Content-Type: application/json'); + +function alpha() +{ + trigger_error("I'M COVERED IN BEES", E_USER_WARNING); +} + +$callback = function($txndata, $errdata) +{ + foreach($txndata as $tkey => $tdata) { + echo "$tkey => $tdata\n"; + }; + + echo "\n"; + + foreach($errdata as $ekey => $edata) { + echo "$ekey => $edata\n"; + }; + + $fingerprint = "CUSTOM ERROR GROUP NAME"; + return $fingerprint; +}; + +$result = newrelic_set_error_group_callback($callback); + +tap_assert($result, "callback registered"); + +alpha(); diff --git a/tests/integration/api/notice_error/test_good_4_args_error_handler.php b/tests/integration/api/notice_error/test_good_4_args_error_handler.php index 6562e4f7a..323bce533 100644 --- a/tests/integration/api/notice_error/test_good_4_args_error_handler.php +++ b/tests/integration/api/notice_error/test_good_4_args_error_handler.php @@ -142,8 +142,8 @@ */ function a() { - trigger_error("4 arg error", E_USER_ERROR); + trigger_error("4 arg error", E_USER_WARNING); } -set_error_handler('newrelic_notice_error', E_USER_ERROR); +set_error_handler('newrelic_notice_error', E_USER_WARNING); a(); diff --git a/tests/integration/api/notice_error/test_good_5_args_error_handler.php b/tests/integration/api/notice_error/test_good_5_args_error_handler.php index 17772271c..485b2f500 100644 --- a/tests/integration/api/notice_error/test_good_5_args_error_handler.php +++ b/tests/integration/api/notice_error/test_good_5_args_error_handler.php @@ -142,8 +142,8 @@ */ function a() { - trigger_error("5 arg error", E_USER_ERROR); + trigger_error("5 arg error", E_USER_WARNING); } -set_error_handler('newrelic_notice_error', E_USER_ERROR); +set_error_handler('newrelic_notice_error', E_USER_WARNING); a(); diff --git a/tests/integration/api/notice_error/test_prioritize_api.php b/tests/integration/api/notice_error/test_prioritize_api.php index 92c2f04ec..4bf0418f8 100644 --- a/tests/integration/api/notice_error/test_prioritize_api.php +++ b/tests/integration/api/notice_error/test_prioritize_api.php @@ -84,7 +84,7 @@ function gamma($password) function omega() { - trigger_error("ignore me", E_USER_ERROR); + trigger_error("ignore me", E_USER_WARNING); } gamma('my super secret password that New Relic cannot know'); diff --git a/tests/integration/api/notice_error/test_priority.php b/tests/integration/api/notice_error/test_priority.php index c33fdeb12..806c11f9e 100644 --- a/tests/integration/api/notice_error/test_priority.php +++ b/tests/integration/api/notice_error/test_priority.php @@ -16,7 +16,7 @@ "?? when", "OtherTransaction/php__FILE__", "highest priority", - "E_USER_ERROR", + "E_USER_WARNING", { "stack_trace": [ " in trigger_error called at __FILE__ (??)" @@ -42,7 +42,7 @@ { "type": "TransactionError", "timestamp": "??", - "error.class": "E_USER_ERROR", + "error.class": "E_USER_WARNING", "error.message": "highest priority", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", @@ -60,9 +60,7 @@ ] */ -/* - * Cause three errors to be noticed in order of decreasing priority. - */ -trigger_error ("highest priority", E_USER_ERROR); -trigger_error ("goldilox", E_USER_WARNING); trigger_error ("lowest priority", E_USER_NOTICE); +trigger_error ("goldilox", E_USER_DEPRECATED); +trigger_error ("highest priority", E_USER_WARNING); +trigger_error ("goldilox", E_USER_DEPRECATED); diff --git a/tests/integration/api/set_user_id/test_set_user_id_error.php b/tests/integration/api/set_user_id/test_set_user_id_error.php index 1632bbca9..dbf782bdb 100644 --- a/tests/integration/api/set_user_id/test_set_user_id_error.php +++ b/tests/integration/api/set_user_id/test_set_user_id_error.php @@ -44,7 +44,7 @@ "??", "OtherTransaction\/php__FILE__", "I'M COVERED IN BEES", - "E_USER_ERROR", + "E_USER_WARNING", { "stack_trace": [ " in trigger_error called at __FILE__ (??)", @@ -82,7 +82,7 @@ { "type": "TransactionError", "timestamp": "??", - "error.class": "E_USER_ERROR", + "error.class": "E_USER_WARNING", "error.message": "I'M COVERED IN BEES", "transactionName": "OtherTransaction\/php__FILE__", "duration": "??", @@ -106,7 +106,7 @@ function alpha() { - trigger_error("I'M COVERED IN BEES", E_USER_ERROR); + trigger_error("I'M COVERED IN BEES", E_USER_WARNING); }; $uuid = "0123456789abcdefghijlkmnopqrstuvwxyz"; diff --git a/tests/integration/attributes/test_transaction_closure_clm.php b/tests/integration/attributes/test_transaction_closure_clm.php index cb6759465..369c7cc49 100644 --- a/tests/integration/attributes/test_transaction_closure_clm.php +++ b/tests/integration/attributes/test_transaction_closure_clm.php @@ -14,6 +14,9 @@ class name, and lineno for closures. if (version_compare(PHP_VERSION, "7.0", "<")) { die("skip: CLM for PHP 5 not supported\n"); } +if (version_compare(PHP_VERSION, "8.4", ">=")) { + die("skip: newer test for PHP 8.4+\n"); +} */ /*INI @@ -94,7 +97,7 @@ class name, and lineno for closures. }, {}, { - "code.lineno": 151, + "code.lineno": 154, "code.filepath": "__FILE__", "code.function": "{closure}" } @@ -115,7 +118,7 @@ class name, and lineno for closures. }, {}, { - "code.lineno": 159, + "code.lineno": 162, "code.filepath": "__FILE__", "code.function": "{closure}" } @@ -136,7 +139,7 @@ class name, and lineno for closures. }, {}, { - "code.lineno": 159, + "code.lineno": 162, "code.filepath": "__FILE__", "code.function": "{closure}" } diff --git a/tests/integration/attributes/test_transaction_closure_clm.php84.php b/tests/integration/attributes/test_transaction_closure_clm.php84.php new file mode 100644 index 000000000..7a30585c4 --- /dev/null +++ b/tests/integration/attributes/test_transaction_closure_clm.php84.php @@ -0,0 +1,167 @@ +=")) { + die("skip: newer test for PHP 8.4+\n"); +} */ /*INI diff --git a/tests/integration/attributes/test_transaction_closure_clm_off.php84.php b/tests/integration/attributes/test_transaction_closure_clm_off.php84.php new file mode 100644 index 000000000..dda499cb6 --- /dev/null +++ b/tests/integration/attributes/test_transaction_closure_clm_off.php84.php @@ -0,0 +1,154 @@ +=")) { + die("skip: PHP >= 8.4.0 not supported\n"); +} */ /*INI diff --git a/tests/integration/errors/test_E_DEPRECATED_2.php84.php b/tests/integration/errors/test_E_DEPRECATED_2.php84.php new file mode 100644 index 000000000..afb0b9ca6 --- /dev/null +++ b/tests/integration/errors/test_E_DEPRECATED_2.php84.php @@ -0,0 +1,81 @@ +=")) { + die("skip: E_USER_ERROR deprecated in PHP 8.4\n"); +} +*/ + /*INI display_errors=1 log_errors=0 diff --git a/tests/integration/errors/test_uncaught_handled_exception_02.php b/tests/integration/errors/test_uncaught_handled_exception_02.php index 5fc475dca..059686adb 100644 --- a/tests/integration/errors/test_uncaught_handled_exception_02.php +++ b/tests/integration/errors/test_uncaught_handled_exception_02.php @@ -26,6 +26,9 @@ if (version_compare(PHP_VERSION, "8.0", "<")) { die("skip: PHP < 8.0.0 not supported\n"); } +if (version_compare(PHP_VERSION, "8.4", ">=")) { + die("skip: newer test for PHP 8.4+\n"); +} */ diff --git a/tests/integration/errors/test_uncaught_handled_exception_02.php84.php b/tests/integration/errors/test_uncaught_handled_exception_02.php84.php new file mode 100644 index 000000000..01a5df516 --- /dev/null +++ b/tests/integration/errors/test_uncaught_handled_exception_02.php84.php @@ -0,0 +1,169 @@ +query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/external/guzzle7/skipif.inc b/tests/integration/external/guzzle7/skipif.inc index 91ee13a0b..e8ede4887 100644 --- a/tests/integration/external/guzzle7/skipif.inc +++ b/tests/integration/external/guzzle7/skipif.inc @@ -6,8 +6,8 @@ require_once(realpath(dirname(__FILE__)) . '/../../../include/unpack_guzzle.php'); -if (version_compare(phpversion(), '7.2.5', '<')) { - die("skip: PHP >= 7.2.5 required\n"); +if (version_compare(phpversion(), '8.1', '<')) { + die("skip: PHP >= 8.1 required\n"); } /* diff --git a/tests/integration/jit/function/test_span_events_are_created_upon_caught_error.php b/tests/integration/jit/function/test_span_events_are_created_upon_caught_error.php index bca70be7e..0c113528a 100644 --- a/tests/integration/jit/function/test_span_events_are_created_upon_caught_error.php +++ b/tests/integration/jit/function/test_span_events_are_created_upon_caught_error.php @@ -15,6 +15,9 @@ =")) { + die("skip: newer test for PHP 8.4+\n"); +} */ diff --git a/tests/integration/jit/function/test_span_events_are_created_upon_caught_error.php84.php b/tests/integration/jit/function/test_span_events_are_created_upon_caught_error.php84.php new file mode 100644 index 000000000..f5ef9e41e --- /dev/null +++ b/tests/integration/jit/function/test_span_events_are_created_upon_caught_error.php84.php @@ -0,0 +1,196 @@ + 'FakeDB', + ) +); +a(); diff --git a/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_error.php b/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_error.php index c3f064b6d..cc1fc14b3 100644 --- a/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_error.php +++ b/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_error.php @@ -13,6 +13,9 @@ =")) { + die("skip: newer test for PHPs 8.4+\n"); +} + +*/ + +/*INI +newrelic.distributed_tracing_enabled=1 +newrelic.transaction_tracer.threshold = 0 +newrelic.span_events_enabled=1 +newrelic.cross_application_tracer.enabled = false +display_errors=1 +log_errors=0 +error_reporting = E_ALL +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=32M +opcache.jit=function +*/ + +/*PHPMODULES +zend_extension=opcache.so +*/ + +/*EXPECT_SPAN_EVENTS +[ + "?? agent run id", + { + "reservoir_size": 10000, + "events_seen": 3 + }, + [ + [ + { + "traceId": "??", + "duration": "??", + "transactionId": "??", + "name": "OtherTransaction\/php__FILE__", + "guid": "??", + "type": "Span", + "category": "generic", + "priority": "??", + "sampled": true, + "nr.entryPoint": true, + "timestamp": "??", + "transaction.name": "OtherTransaction\/php__FILE__" + }, + {}, + {} + ], + [ + { + "type": "Span", + "traceId": "??", + "transactionId": "??", + "sampled": true, + "priority": "??", + "name": "Datastore\/statement\/FakeDB\/other\/other", + "guid": "??", + "timestamp": "??", + "duration": "??", + "category": "datastore", + "parentId": "??", + "span.kind": "client", + "component": "FakeDB" + }, + {}, + { + "db.instance": "unknown", + "peer.hostname": "unknown", + "peer.address": "unknown:unknown" + } + ], + [ + { + "type": "Span", + "traceId": "??", + "transactionId": "??", + "sampled": true, + "priority": "??", + "name": "Custom\/a", + "guid": "??", + "timestamp": "??", + "duration": "??", + "category": "generic", + "parentId": "??" + }, + {}, + { + "error.message": "foo", + "error.class": "E_USER_ERROR", + "code.lineno": "??", + "code.filepath": "__FILE__", + "code.function": "??" + } + ] + ] +] +*/ + +/*EXPECT_REGEX +^\s*(PHP )?Fatal error:\s*foo in .*? on line [0-9]+\s*$ +*/ + +function a() +{ + time_nanosleep(0, 100000000); + trigger_error('foo', E_USER_ERROR); +} + +newrelic_record_datastore_segment( + function () { + time_nanosleep(0, 100000000); + }, array( + 'product' => 'FakeDB', + ) +); +a(); + +echo 'this should never be printed'; diff --git a/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_handled_exception.php b/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_handled_exception.php index 2381e2045..7624a2a4b 100644 --- a/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_handled_exception.php +++ b/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_handled_exception.php @@ -15,6 +15,9 @@ =")) { + die("skip: newer test for PHP 8.4+\n"); +} */ diff --git a/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_handled_exception.php84.php b/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_handled_exception.php84.php new file mode 100644 index 000000000..28099b17c --- /dev/null +++ b/tests/integration/jit/function/test_span_events_are_created_upon_uncaught_handled_exception.php84.php @@ -0,0 +1,200 @@ + 'FakeDB', + ) +); +a(); + +echo 'this should never be printed'; diff --git a/tests/integration/jit/tracing/test_span_events_are_created_upon_caught_error.php b/tests/integration/jit/tracing/test_span_events_are_created_upon_caught_error.php index ebde4a26b..74e03bf46 100644 --- a/tests/integration/jit/tracing/test_span_events_are_created_upon_caught_error.php +++ b/tests/integration/jit/tracing/test_span_events_are_created_upon_caught_error.php @@ -15,6 +15,9 @@ =")) { + die("skip: newer test for PHP 8.4+\n"); +} */ diff --git a/tests/integration/jit/tracing/test_span_events_are_created_upon_caught_error.php84.php b/tests/integration/jit/tracing/test_span_events_are_created_upon_caught_error.php84.php new file mode 100644 index 000000000..eeb18dc14 --- /dev/null +++ b/tests/integration/jit/tracing/test_span_events_are_created_upon_caught_error.php84.php @@ -0,0 +1,195 @@ + 'FakeDB', + ) +); +a(); diff --git a/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_error.php b/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_error.php index ee1a578ae..51f8b899a 100644 --- a/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_error.php +++ b/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_error.php @@ -13,6 +13,9 @@ =")) { + die("skip: newer test for PHPs 8.4+\n"); +} */ diff --git a/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_error.php84.php b/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_error.php84.php new file mode 100644 index 000000000..54660f8a3 --- /dev/null +++ b/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_error.php84.php @@ -0,0 +1,135 @@ + 'FakeDB', + ) +); +a(); diff --git a/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_handled_exception.php b/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_handled_exception.php index 395b1231f..7444c28e7 100644 --- a/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_handled_exception.php +++ b/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_handled_exception.php @@ -15,6 +15,9 @@ =")) { + die("skip: newer test for PHP 8.4+\n"); +} */ diff --git a/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_handled_exception.php84.php b/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_handled_exception.php84.php new file mode 100644 index 000000000..922a0c5a7 --- /dev/null +++ b/tests/integration/jit/tracing/test_span_events_are_created_upon_uncaught_handled_exception.php84.php @@ -0,0 +1,197 @@ + 'FakeDB', + ) +); +a(); + +echo 'this should never be printed'; diff --git a/tests/integration/opcache/disabled/test_span_events_are_created_upon_caught_error.php b/tests/integration/opcache/disabled/test_span_events_are_created_upon_caught_error.php index d61b7fea0..ce62bfc12 100644 --- a/tests/integration/opcache/disabled/test_span_events_are_created_upon_caught_error.php +++ b/tests/integration/opcache/disabled/test_span_events_are_created_upon_caught_error.php @@ -15,6 +15,9 @@ =")) { + die("skip: newer test for PHP 8.4+\n"); +} */ diff --git a/tests/integration/opcache/disabled/test_span_events_are_created_upon_caught_error.php84.php b/tests/integration/opcache/disabled/test_span_events_are_created_upon_caught_error.php84.php new file mode 100644 index 000000000..86c24a776 --- /dev/null +++ b/tests/integration/opcache/disabled/test_span_events_are_created_upon_caught_error.php84.php @@ -0,0 +1,193 @@ + 'FakeDB', + ) +); +a(); diff --git a/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_error.php b/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_error.php index bc42257cc..49320f19b 100644 --- a/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_error.php +++ b/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_error.php @@ -13,6 +13,9 @@ =")) { + die("skip: newer test for PHPs 8.4+\n"); +} */ diff --git a/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_error.php84.php b/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_error.php84.php new file mode 100644 index 000000000..35014d54f --- /dev/null +++ b/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_error.php84.php @@ -0,0 +1,132 @@ + 'FakeDB', + ) +); +a(); diff --git a/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_handled_exception.php b/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_handled_exception.php index d45a094b8..76dd4fe41 100644 --- a/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_handled_exception.php +++ b/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_handled_exception.php @@ -17,6 +17,9 @@ if (version_compare(PHP_VERSION, "8.0", "<")) { die("skip: PHP < 7.0.0 not supported\n"); } +if (version_compare(PHP_VERSION, "8.4", ">=")) { + die("skip: newer test for PHP 8.4+\n"); +} require('skipif.inc'); diff --git a/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_handled_exception.php84.php b/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_handled_exception.php84.php new file mode 100644 index 000000000..e4be687b9 --- /dev/null +++ b/tests/integration/opcache/disabled/test_span_events_are_created_upon_uncaught_handled_exception.php84.php @@ -0,0 +1,197 @@ + 'FakeDB', + ) +); +a(); + +echo 'this should never be printed'; diff --git a/tests/integration/pdo/mysql/base-class/test_instance_reporting_port.php b/tests/integration/pdo/mysql/base-class/test_instance_reporting_port.php new file mode 100644 index 000000000..0742b5461 --- /dev/null +++ b/tests/integration/pdo/mysql/base-class/test_instance_reporting_port.php @@ -0,0 +1,157 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[MYSQL_HOST]", + "port_path_or_id": "ENV[MYSQL_PORT]", + "database_name": "ENV[MYSQL_DB]" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[MYSQL_HOST]", + "port_path_or_id": "ENV[MYSQL_PORT]", + "database_name": "ENV[MYSQL_DB]" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[MYSQL_HOST]", + "peer.address": "ENV[MYSQL_HOST]:ENV[MYSQL_PORT]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[MYSQL_HOST]", + "peer.address": "ENV[MYSQL_HOST]:ENV[MYSQL_PORT]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +test_instance_reporting(new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), 0); diff --git a/tests/integration/pdo/mysql/base-class/test_instance_reporting_socket.php b/tests/integration/pdo/mysql/base-class/test_instance_reporting_socket.php new file mode 100644 index 000000000..95177d7c7 --- /dev/null +++ b/tests/integration/pdo/mysql/base-class/test_instance_reporting_socket.php @@ -0,0 +1,160 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "__HOST__", + "port_path_or_id": "ENV[MYSQL_SOCKET]", + "database_name": "ENV[MYSQL_DB]" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "__HOST__", + "port_path_or_id": "ENV[MYSQL_SOCKET]", + "database_name": "ENV[MYSQL_DB]" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "__HOST__", + "peer.address": "__HOST__:ENV[MYSQL_SOCKET]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "__HOST__", + "peer.address": "__HOST__:ENV[MYSQL_SOCKET]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$DSN = 'mysql:'; +$DSN .= 'unix_socket=' . $MYSQL_SOCKET . ';'; +$DSN .= 'dbname=' . $MYSQL_DB . ';'; + +test_instance_reporting(new PDO($DSN, $MYSQL_USER, $MYSQL_PASSWD), 0); diff --git a/tests/integration/pdo/mysql/base-class/test_prepared_stmt_basic.php b/tests/integration/pdo/mysql/base-class/test_prepared_stmt_basic.php new file mode 100644 index 000000000..93e54a033 --- /dev/null +++ b/tests/integration/pdo/mysql/base-class/test_prepared_stmt_basic.php @@ -0,0 +1,110 @@ +", + "?? SQL id", + "select * from information_schema.tables limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ], + "explain_plan": "??" + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables limit 1;'; +test_prepared_stmt(new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), $query); diff --git a/tests/integration/pdo/mysql/base-class/test_prepared_stmt_bind_value.php b/tests/integration/pdo/mysql/base-class/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..34868e9ec --- /dev/null +++ b/tests/integration/pdo/mysql/base-class/test_prepared_stmt_bind_value.php @@ -0,0 +1,111 @@ +", + "?? SQL id", + "select * from information_schema.tables where table_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ], + "explain_plan": "??" + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables where table_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables where table_name = ? limit 1;'; +test_prepared_stmt(new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), $query); diff --git a/tests/integration/pdo/mysql/base-class/test_query_1_arg.php b/tests/integration/pdo/mysql/base-class/test_query_1_arg.php new file mode 100644 index 000000000..65a1da4fa --- /dev/null +++ b/tests/integration/pdo/mysql/base-class/test_query_1_arg.php @@ -0,0 +1,52 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[MYSQL_HOST]", + "port_path_or_id": "ENV[MYSQL_PORT]", + "database_name": "ENV[MYSQL_DB]" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[MYSQL_HOST]", + "port_path_or_id": "ENV[MYSQL_PORT]", + "database_name": "ENV[MYSQL_DB]" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[MYSQL_HOST]", + "peer.address": "ENV[MYSQL_HOST]:ENV[MYSQL_PORT]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[MYSQL_HOST]", + "peer.address": "ENV[MYSQL_HOST]:ENV[MYSQL_PORT]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +test_instance_reporting(new Pdo\Mysql($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), 0); diff --git a/tests/integration/pdo/mysql/constructor/test_instance_reporting_socket.php b/tests/integration/pdo/mysql/constructor/test_instance_reporting_socket.php new file mode 100644 index 000000000..073bceb80 --- /dev/null +++ b/tests/integration/pdo/mysql/constructor/test_instance_reporting_socket.php @@ -0,0 +1,161 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "__HOST__", + "port_path_or_id": "ENV[MYSQL_SOCKET]", + "database_name": "ENV[MYSQL_DB]" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "__HOST__", + "port_path_or_id": "ENV[MYSQL_SOCKET]", + "database_name": "ENV[MYSQL_DB]" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "__HOST__", + "peer.address": "__HOST__:ENV[MYSQL_SOCKET]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "__HOST__", + "peer.address": "__HOST__:ENV[MYSQL_SOCKET]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$DSN = 'mysql:'; +$DSN .= 'unix_socket=' . $MYSQL_SOCKET . ';'; +$DSN .= 'dbname=' . $MYSQL_DB . ';'; + +test_instance_reporting(new Pdo\Mysql($DSN, $MYSQL_USER, $MYSQL_PASSWD), 0); diff --git a/tests/integration/pdo/mysql/constructor/test_prepared_stmt_basic.php b/tests/integration/pdo/mysql/constructor/test_prepared_stmt_basic.php new file mode 100644 index 000000000..695dab225 --- /dev/null +++ b/tests/integration/pdo/mysql/constructor/test_prepared_stmt_basic.php @@ -0,0 +1,111 @@ +", + "?? SQL id", + "select * from information_schema.tables limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ], + "explain_plan": "??" + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables limit 1;'; +test_prepared_stmt(new Pdo\Mysql($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), $query); diff --git a/tests/integration/pdo/mysql/constructor/test_prepared_stmt_bind_value.php b/tests/integration/pdo/mysql/constructor/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..214533332 --- /dev/null +++ b/tests/integration/pdo/mysql/constructor/test_prepared_stmt_bind_value.php @@ -0,0 +1,112 @@ +", + "?? SQL id", + "select * from information_schema.tables where table_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ], + "explain_plan": "??" + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables where table_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables where table_name = ? limit 1;'; +test_prepared_stmt(new Pdo\Mysql($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), $query); diff --git a/tests/integration/pdo/mysql/constructor/test_query_1_arg.php b/tests/integration/pdo/mysql/constructor/test_query_1_arg.php new file mode 100644 index 000000000..63d641e70 --- /dev/null +++ b/tests/integration/pdo/mysql/constructor/test_query_1_arg.php @@ -0,0 +1,53 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[MYSQL_HOST]", + "port_path_or_id": "ENV[MYSQL_PORT]", + "database_name": "ENV[MYSQL_DB]" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[MYSQL_HOST]", + "port_path_or_id": "ENV[MYSQL_PORT]", + "database_name": "ENV[MYSQL_DB]" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[MYSQL_HOST]", + "peer.address": "ENV[MYSQL_HOST]:ENV[MYSQL_PORT]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[MYSQL_HOST]", + "peer.address": "ENV[MYSQL_HOST]:ENV[MYSQL_PORT]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +test_instance_reporting(PDO::connect($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), 0); diff --git a/tests/integration/pdo/mysql/factory/test_instance_reporting_socket.php b/tests/integration/pdo/mysql/factory/test_instance_reporting_socket.php new file mode 100644 index 000000000..796d108db --- /dev/null +++ b/tests/integration/pdo/mysql/factory/test_instance_reporting_socket.php @@ -0,0 +1,161 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "__HOST__", + "port_path_or_id": "ENV[MYSQL_SOCKET]", + "database_name": "ENV[MYSQL_DB]" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "__HOST__", + "port_path_or_id": "ENV[MYSQL_SOCKET]", + "database_name": "ENV[MYSQL_DB]" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "__HOST__", + "peer.address": "__HOST__:ENV[MYSQL_SOCKET]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "__HOST__", + "peer.address": "__HOST__:ENV[MYSQL_SOCKET]", + "db.instance": "ENV[MYSQL_DB]", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$DSN = 'mysql:'; +$DSN .= 'unix_socket=' . $MYSQL_SOCKET . ';'; +$DSN .= 'dbname=' . $MYSQL_DB . ';'; + +test_instance_reporting(PDO::connect($DSN, $MYSQL_USER, $MYSQL_PASSWD), 0); diff --git a/tests/integration/pdo/mysql/factory/test_prepared_stmt_basic.php b/tests/integration/pdo/mysql/factory/test_prepared_stmt_basic.php new file mode 100644 index 000000000..6488f0ffe --- /dev/null +++ b/tests/integration/pdo/mysql/factory/test_prepared_stmt_basic.php @@ -0,0 +1,111 @@ +", + "?? SQL id", + "select * from information_schema.tables limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ], + "explain_plan": "??" + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables limit 1;'; +test_prepared_stmt(PDO::connect($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), $query); diff --git a/tests/integration/pdo/mysql/factory/test_prepared_stmt_bind_value.php b/tests/integration/pdo/mysql/factory/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..e1cae652e --- /dev/null +++ b/tests/integration/pdo/mysql/factory/test_prepared_stmt_bind_value.php @@ -0,0 +1,112 @@ +", + "?? SQL id", + "select * from information_schema.tables where table_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ], + "explain_plan": "??" + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables where table_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables where table_name = ? limit 1;'; +test_prepared_stmt(PDO::connect($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD), $query); diff --git a/tests/integration/pdo/mysql/factory/test_query_1_arg.php b/tests/integration/pdo/mysql/factory/test_query_1_arg.php new file mode 100644 index 000000000..b15999e0b --- /dev/null +++ b/tests/integration/pdo/mysql/factory/test_query_1_arg.php @@ -0,0 +1,53 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[PG_HOST]", + "port_path_or_id": "ENV[PG_PORT]", + "database_name": "postgres" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[PG_HOST]", + "port_path_or_id": "ENV[PG_PORT]", + "database_name": "postgres" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[PG_HOST]", + "peer.address": "ENV[PG_HOST]:ENV[PG_PORT]", + "db.instance": "postgres", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[PG_HOST]", + "peer.address": "ENV[PG_HOST]:ENV[PG_PORT]", + "db.instance": "postgres", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +test_instance_reporting(new PDO($PDO_PGSQL_DSN, $PG_USER, $PG_PW), 0); diff --git a/tests/integration/pdo/pgsql/base-class/test_prepared_stmt_basic.php b/tests/integration/pdo/pgsql/base-class/test_prepared_stmt_basic.php new file mode 100644 index 000000000..9c7960080 --- /dev/null +++ b/tests/integration/pdo/pgsql/base-class/test_prepared_stmt_basic.php @@ -0,0 +1,106 @@ +", + "?? SQL id", + "select * from information_schema.tables limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables limit 1;'; +test_prepared_stmt(new PDO($PDO_PGSQL_DSN, $PG_USER, $PG_PW), $query); diff --git a/tests/integration/pdo/pgsql/base-class/test_prepared_stmt_bind_value.php b/tests/integration/pdo/pgsql/base-class/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..56737cafb --- /dev/null +++ b/tests/integration/pdo/pgsql/base-class/test_prepared_stmt_bind_value.php @@ -0,0 +1,107 @@ +", + "?? SQL id", + "select * from information_schema.tables where table_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables where table_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables where table_name = ? limit 1;'; +test_prepared_stmt(new PDO($PDO_PGSQL_DSN, $PG_USER, $PG_PW), $query); diff --git a/tests/integration/pdo/pgsql/base-class/test_query_1_arg.php b/tests/integration/pdo/pgsql/base-class/test_query_1_arg.php new file mode 100644 index 000000000..48e212208 --- /dev/null +++ b/tests/integration/pdo/pgsql/base-class/test_query_1_arg.php @@ -0,0 +1,55 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[PG_HOST]", + "port_path_or_id": "ENV[PG_PORT]", + "database_name": "postgres" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[PG_HOST]", + "port_path_or_id": "ENV[PG_PORT]", + "database_name": "postgres" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[PG_HOST]", + "peer.address": "ENV[PG_HOST]:ENV[PG_PORT]", + "db.instance": "postgres", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[PG_HOST]", + "peer.address": "ENV[PG_HOST]:ENV[PG_PORT]", + "db.instance": "postgres", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +test_instance_reporting(new Pdo\Pgsql($PDO_PGSQL_DSN, $PG_USER, $PG_PW), 0); diff --git a/tests/integration/pdo/pgsql/constructor/test_prepared_stmt_basic.php b/tests/integration/pdo/pgsql/constructor/test_prepared_stmt_basic.php new file mode 100644 index 000000000..131ab0935 --- /dev/null +++ b/tests/integration/pdo/pgsql/constructor/test_prepared_stmt_basic.php @@ -0,0 +1,107 @@ +", + "?? SQL id", + "select * from information_schema.tables limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables limit 1;'; +test_prepared_stmt(new Pdo\Pgsql($PDO_PGSQL_DSN, $PG_USER, $PG_PW), $query); diff --git a/tests/integration/pdo/pgsql/constructor/test_prepared_stmt_bind_value.php b/tests/integration/pdo/pgsql/constructor/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..c954060f8 --- /dev/null +++ b/tests/integration/pdo/pgsql/constructor/test_prepared_stmt_bind_value.php @@ -0,0 +1,108 @@ +", + "?? SQL id", + "select * from information_schema.tables where table_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables where table_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables where table_name = ? limit 1;'; +test_prepared_stmt(new Pdo\Pgsql($PDO_PGSQL_DSN, $PG_USER, $PG_PW), $query); diff --git a/tests/integration/pdo/pgsql/constructor/test_query_1_arg.php b/tests/integration/pdo/pgsql/constructor/test_query_1_arg.php new file mode 100644 index 000000000..c3cc9381d --- /dev/null +++ b/tests/integration/pdo/pgsql/constructor/test_query_1_arg.php @@ -0,0 +1,52 @@ +", + "?? SQL id", + "DROP TABLE ENV[DATASTORE_COLLECTION];", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[PG_HOST]", + "port_path_or_id": "ENV[PG_PORT]", + "database_name": "postgres" + } + ], + [ + "OtherTransaction/php__FILE__", + "", + "?? SQL id", + "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDO::exec called at .*\/", + " in test_instance_reporting called at __FILE__ (??)" + ], + "host": "ENV[PG_HOST]", + "port_path_or_id": "ENV[PG_PORT]", + "database_name": "postgres" + } + ] + ] +] +*/ + +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/create", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[PG_HOST]", + "peer.address": "ENV[PG_HOST]:ENV[PG_PORT]", + "db.instance": "postgres", + "db.statement": "CREATE TABLE ENV[DATASTORE_COLLECTION] (id INT, description VARCHAR(?));" + } + ], + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/drop", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.hostname": "ENV[PG_HOST]", + "peer.address": "ENV[PG_HOST]:ENV[PG_PORT]", + "db.instance": "postgres", + "db.statement": "DROP TABLE ENV[DATASTORE_COLLECTION];" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_instance_reporting.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +test_instance_reporting(PDO::connect($PDO_PGSQL_DSN, $PG_USER, $PG_PW), 0); diff --git a/tests/integration/pdo/pgsql/factory/test_prepared_stmt_basic.php b/tests/integration/pdo/pgsql/factory/test_prepared_stmt_basic.php new file mode 100644 index 000000000..58841fbf7 --- /dev/null +++ b/tests/integration/pdo/pgsql/factory/test_prepared_stmt_basic.php @@ -0,0 +1,107 @@ +", + "?? SQL id", + "select * from information_schema.tables limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables limit 1;'; +test_prepared_stmt(PDO::connect($PDO_PGSQL_DSN, $PG_USER, $PG_PW), $query); diff --git a/tests/integration/pdo/pgsql/factory/test_prepared_stmt_bind_value.php b/tests/integration/pdo/pgsql/factory/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..7ccfa9e9f --- /dev/null +++ b/tests/integration/pdo/pgsql/factory/test_prepared_stmt_bind_value.php @@ -0,0 +1,108 @@ +", + "?? SQL id", + "select * from information_schema.tables where table_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from information_schema.tables where table_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from information_schema.tables where table_name = ? limit 1;'; +test_prepared_stmt(PDO::connect($PDO_PGSQL_DSN, $PG_USER, $PG_PW), $query); diff --git a/tests/integration/pdo/pgsql/factory/test_query_1_arg.php b/tests/integration/pdo/pgsql/factory/test_query_1_arg.php new file mode 100644 index 000000000..1f47b55b7 --- /dev/null +++ b/tests/integration/pdo/pgsql/factory/test_query_1_arg.php @@ -0,0 +1,52 @@ += 8.4\n"); +} + diff --git a/tests/integration/pdo/skipif_pgsql.inc b/tests/integration/pdo/skipif_pgsql.inc new file mode 100644 index 000000000..92caf44be --- /dev/null +++ b/tests/integration/pdo/skipif_pgsql.inc @@ -0,0 +1,37 @@ +getMessage() . "\n"); +} diff --git a/tests/integration/pdo/sqlite/base-class/test_prepared_stmt_basic.php b/tests/integration/pdo/sqlite/base-class/test_prepared_stmt_basic.php new file mode 100644 index 000000000..ddf000ce8 --- /dev/null +++ b/tests/integration/pdo/sqlite/base-class/test_prepared_stmt_basic.php @@ -0,0 +1,106 @@ +", + "?? SQL id", + "select * from ENV[DATASTORE_COLLECTION] limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from ENV[DATASTORE_COLLECTION] limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from sqlite_master limit 1;'; +test_prepared_stmt(new PDO('sqlite::memory:'), $query); diff --git a/tests/integration/pdo/sqlite/base-class/test_prepared_stmt_bind_value.php b/tests/integration/pdo/sqlite/base-class/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..a26e0802f --- /dev/null +++ b/tests/integration/pdo/sqlite/base-class/test_prepared_stmt_bind_value.php @@ -0,0 +1,107 @@ +", + "?? SQL id", + "select * from ENV[DATASTORE_COLLECTION] where tbl_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from ENV[DATASTORE_COLLECTION] where tbl_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from sqlite_master where tbl_name = ? limit 1;'; +test_prepared_stmt(new PDO('sqlite::memory:'), $query); diff --git a/tests/integration/pdo/test_query_1.php b/tests/integration/pdo/sqlite/base-class/test_query_1_arg.php similarity index 76% rename from tests/integration/pdo/test_query_1.php rename to tests/integration/pdo/sqlite/base-class/test_query_1_arg.php index 21b932f49..df16dc8a3 100644 --- a/tests/integration/pdo/test_query_1.php +++ b/tests/integration/pdo/sqlite/base-class/test_query_1_arg.php @@ -6,14 +6,12 @@ /*DESCRIPTION The agent should record Datastore metrics for the one argument form of -PDO::query(). +PDO::query() when PDO base class constructor is used to create connection +object. */ /*SKIPIF -=")) { - die("skip: PHP >= 8.1.0 not supported\n"); -} +exec("CREATE TABLE test (id INT, desc VARCHAR(10));"), 'create table'); - - tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert one'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (2, 'two');"), 'insert two'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (3, 'three');"), 'insert three'); - - $expected = array( - array('id' => '1', 'desc' => 'one'), - array('id' => '2', 'desc' => 'two'), - array('id' => '3', 'desc' => 'three') - ); - - $result = $conn->query('SELECT * FROM test;'); - $actual = $result->fetchAll(PDO::FETCH_ASSOC); - $result->closeCursor(); - tap_equal($expected, $actual, 'query (1-arg)'); - - tap_equal(1, $conn->exec("DROP TABLE test;"), 'drop table'); -} - -test_pdo_query(); +test_pdo_query(new PDO('sqlite::memory:')); diff --git a/tests/integration/pdo/test_query_3.php b/tests/integration/pdo/sqlite/base-class/test_query_fetch_class.php similarity index 82% rename from tests/integration/pdo/test_query_3.php rename to tests/integration/pdo/sqlite/base-class/test_query_fetch_class.php index e37919a72..e84fb4027 100644 --- a/tests/integration/pdo/test_query_3.php +++ b/tests/integration/pdo/sqlite/base-class/test_query_fetch_class.php @@ -6,11 +6,12 @@ /*DESCRIPTION The agent should record database metrics for the FETCH_CLASS variant of -PDO::query(). +PDO::query() when PDO base class constructor is used to create connection +object. */ /*SKIPIF -exec("CREATE TABLE test (id INT, desc VARCHAR(10));"), 'create table'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert row'); - - $expected = new Row(); - $expected->id = '1'; - $expected->desc = 'one'; - - $actual = $conn->query('SELECT * FROM test;', PDO::FETCH_CLASS, 'Row')->fetch(); - tap_assert($expected == $actual, 'fetch row as object'); - - tap_equal(1, $conn->exec("DROP TABLE test;"), 'drop table'); -} - -test_pdo_query(); +test_pdo_query(new PDO('sqlite::memory:')); diff --git a/tests/integration/pdo/test_query_2.php b/tests/integration/pdo/sqlite/base-class/test_query_fetch_column.php similarity index 81% rename from tests/integration/pdo/test_query_2.php rename to tests/integration/pdo/sqlite/base-class/test_query_fetch_column.php index e0269144c..37989527d 100644 --- a/tests/integration/pdo/test_query_2.php +++ b/tests/integration/pdo/sqlite/base-class/test_query_fetch_column.php @@ -6,11 +6,12 @@ /*DESCRIPTION The agent should record database metrics for the FETCH_COLUMN variant of -PDO::query(). +PDO::query() when PDO base class constructor is used to create connection +object. */ /*SKIPIF -exec("CREATE TABLE test (id INT, desc VARCHAR(10));"), 'create table'); - - tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert one'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (2, 'two');"), 'insert two'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (3, 'three');"), 'insert three'); - - $result = $conn->query('SELECT * FROM test;', PDO::FETCH_COLUMN, 1); - $actual = $result->fetchAll(PDO::FETCH_ASSOC); - $result->closeCursor(); - tap_equal(3, count($actual), 'fetch column'); - - tap_equal(1, $conn->exec("DROP TABLE test;"), 'drop table'); -} - -test_pdo_query(); +test_pdo_query(new PDO('sqlite::memory:')); diff --git a/tests/integration/pdo/test_query_2_logging_off.php b/tests/integration/pdo/sqlite/base-class/test_query_fetch_column_logging_off.php similarity index 81% rename from tests/integration/pdo/test_query_2_logging_off.php rename to tests/integration/pdo/sqlite/base-class/test_query_fetch_column_logging_off.php index f3d2da948..76a35f1fc 100644 --- a/tests/integration/pdo/test_query_2_logging_off.php +++ b/tests/integration/pdo/sqlite/base-class/test_query_fetch_column_logging_off.php @@ -6,11 +6,12 @@ /*DESCRIPTION The agent should record database metrics for the FETCH_COLUMN variant of -PDO::query(). +PDO::query() when PDO base class constructor is used to create connection +object. */ /*SKIPIF -exec("CREATE TABLE test (id INT, desc VARCHAR(10));"), 'create table'); - - tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert one'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (2, 'two');"), 'insert two'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (3, 'three');"), 'insert three'); - - $result = $conn->query('SELECT * FROM test;', PDO::FETCH_COLUMN, 1); - $actual = $result->fetchAll(PDO::FETCH_ASSOC); - $result->closeCursor(); - tap_equal(3, count($actual), 'fetch column'); - - tap_equal(1, $conn->exec("DROP TABLE test;"), 'drop table'); -} - -test_pdo_query(); +test_pdo_query(new PDO('sqlite::memory:')); diff --git a/tests/integration/pdo/test_query_4.php b/tests/integration/pdo/sqlite/base-class/test_query_fetch_into.php similarity index 82% rename from tests/integration/pdo/test_query_4.php rename to tests/integration/pdo/sqlite/base-class/test_query_fetch_into.php index 884bb1f8d..63c132317 100644 --- a/tests/integration/pdo/test_query_4.php +++ b/tests/integration/pdo/sqlite/base-class/test_query_fetch_into.php @@ -6,11 +6,12 @@ /*DESCRIPTION The agent should record database metrics for the FETCH_INTO variant of -PDO::query(). +PDO::query() when PDO base class constructor is used to create connection +object. */ /*SKIPIF -exec("CREATE TABLE test (id INT, desc VARCHAR(10));"), 'create table'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert row'); - - $expected = new Row(); - $expected->id = '1'; - $expected->desc = 'one'; - - $actual = new Row(); - $conn->query('SELECT * FROM test;', PDO::FETCH_INTO, $actual)->fetch(); - tap_assert($expected == $actual, 'fetch row into object'); - - tap_equal(1, $conn->exec("DROP TABLE test;"), 'drop table'); -} - -test_pdo_query(); +test_pdo_query(new PDO('sqlite::memory:')); diff --git a/tests/integration/pdo/sqlite/constructor/test_prepared_stmt_basic.php b/tests/integration/pdo/sqlite/constructor/test_prepared_stmt_basic.php new file mode 100644 index 000000000..bdb32dd76 --- /dev/null +++ b/tests/integration/pdo/sqlite/constructor/test_prepared_stmt_basic.php @@ -0,0 +1,107 @@ +", + "?? SQL id", + "select * from ENV[DATASTORE_COLLECTION] limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from ENV[DATASTORE_COLLECTION] limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from sqlite_schema limit 1;'; +test_prepared_stmt(new Pdo\Sqlite('sqlite::memory:'), $query); diff --git a/tests/integration/pdo/sqlite/constructor/test_prepared_stmt_bind_value.php b/tests/integration/pdo/sqlite/constructor/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..36e02cb5e --- /dev/null +++ b/tests/integration/pdo/sqlite/constructor/test_prepared_stmt_bind_value.php @@ -0,0 +1,108 @@ +", + "?? SQL id", + "select * from ENV[DATASTORE_COLLECTION] where tbl_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from ENV[DATASTORE_COLLECTION] where tbl_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from sqlite_schema where tbl_name = ? limit 1;'; +test_prepared_stmt(new Pdo\Sqlite('sqlite::memory:'), $query); diff --git a/tests/integration/pdo/sqlite/constructor/test_query_1_arg.php b/tests/integration/pdo/sqlite/constructor/test_query_1_arg.php new file mode 100644 index 000000000..d0dc104cf --- /dev/null +++ b/tests/integration/pdo/sqlite/constructor/test_query_1_arg.php @@ -0,0 +1,75 @@ +exec("CREATE TABLE test (id INT, desc VARCHAR(10));"), 'create table'); - - tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert one'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (2, 'two');"), 'insert two'); - tap_equal(1, $conn->exec("INSERT INTO test VALUES (3, 'three');"), 'insert three'); - - $expected = array( - array('id' => 1, 'desc' => 'one'), - array('id' => 2, 'desc' => 'two'), - array('id' => 3, 'desc' => 'three') - ); - - $result = $conn->query('SELECT * FROM test;'); - $actual = $result->fetchAll(PDO::FETCH_ASSOC); - $result->closeCursor(); - tap_equal($expected, $actual, 'query (1-arg)'); - - tap_equal(1, $conn->exec("DROP TABLE test;"), 'drop table'); +class MyPDO extends \PDO +{ } -test_pdo_query(); +test_pdo_query(new MyPDO('sqlite::memory:')); diff --git a/tests/integration/pdo/sqlite/factory/test_prepared_stmt_basic.php b/tests/integration/pdo/sqlite/factory/test_prepared_stmt_basic.php new file mode 100644 index 000000000..652f65165 --- /dev/null +++ b/tests/integration/pdo/sqlite/factory/test_prepared_stmt_basic.php @@ -0,0 +1,107 @@ +", + "?? SQL id", + "select * from ENV[DATASTORE_COLLECTION] limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from ENV[DATASTORE_COLLECTION] limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_basic.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from sqlite_schema limit 1;'; +test_prepared_stmt(PDO::Connect('sqlite::memory:'), $query); diff --git a/tests/integration/pdo/sqlite/factory/test_prepared_stmt_bind_value.php b/tests/integration/pdo/sqlite/factory/test_prepared_stmt_bind_value.php new file mode 100644 index 000000000..c4c548970 --- /dev/null +++ b/tests/integration/pdo/sqlite/factory/test_prepared_stmt_bind_value.php @@ -0,0 +1,108 @@ +", + "?? SQL id", + "select * from ENV[DATASTORE_COLLECTION] where tbl_name = ? limit ?;", + "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + 1, + "?? total time", + "?? min time", + "?? max time", + { + "backtrace": [ + "/ in PDOStatement::execute called at .*\/", + " in test_prepared_stmt called at __FILE__ (??)" + ] + } + ] + ] +] +*/ + +// peer.address is unknown:unknown because instance_reporting is disabled +/*EXPECT_SPAN_EVENTS_LIKE +[ + [ + { + "category": "datastore", + "type": "Span", + "guid": "??", + "traceId": "??", + "transactionId": "??", + "name": "Datastore/statement/ENV[DATASTORE_PRODUCT]/ENV[DATASTORE_COLLECTION]/select", + "timestamp": "??", + "duration": "??", + "priority": "??", + "sampled": true, + "parentId": "??", + "span.kind": "client", + "component": "ENV[DATASTORE_PRODUCT]" + }, + {}, + { + "peer.address": "unknown:unknown", + "db.statement": "select * from ENV[DATASTORE_COLLECTION] where tbl_name = ? limit ?;" + } + ] +] +*/ + +require_once(realpath (dirname ( __FILE__ )) . '/../../test_prepared_stmt_bind_value.inc'); +require_once(realpath (dirname ( __FILE__ )) . '/../../../../include/config.php'); + +$query = 'select * from sqlite_schema where tbl_name = ? limit 1;'; +test_prepared_stmt(PDO::Connect('sqlite::memory:'), $query); diff --git a/tests/integration/pdo/sqlite/factory/test_query_1_arg.php b/tests/integration/pdo/sqlite/factory/test_query_1_arg.php new file mode 100644 index 000000000..edab45185 --- /dev/null +++ b/tests/integration/pdo/sqlite/factory/test_query_1_arg.php @@ -0,0 +1,75 @@ +", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -85,7 +85,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_empty_driver_options.php81.php b/tests/integration/pdo/test_empty_driver_options.php81.php index 60f3e3778..e29984f62 100644 --- a/tests/integration/pdo/test_empty_driver_options.php81.php +++ b/tests/integration/pdo/test_empty_driver_options.php81.php @@ -32,7 +32,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -85,7 +85,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_instance_reporting.inc b/tests/integration/pdo/test_instance_reporting.inc new file mode 100644 index 000000000..0ae7fb6a8 --- /dev/null +++ b/tests/integration/pdo/test_instance_reporting.inc @@ -0,0 +1,33 @@ +exec("CREATE TABLE test (id INT, description VARCHAR(10));"), 'create table'); + tap_equal($want_drop_table_result, $conn->exec("DROP TABLE test;"), 'drop table'); +} diff --git a/tests/integration/pdo/test_instance_slow_sql_1.php b/tests/integration/pdo/test_instance_slow_sql_1.php index 465ab00a1..b767100ba 100644 --- a/tests/integration/pdo/test_instance_slow_sql_1.php +++ b/tests/integration/pdo/test_instance_slow_sql_1.php @@ -45,7 +45,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -103,7 +103,7 @@ function test_query() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_query(); diff --git a/tests/integration/pdo/test_instance_slow_sql_1.php81.php b/tests/integration/pdo/test_instance_slow_sql_1.php81.php index 80a890f2e..1d217e04f 100644 --- a/tests/integration/pdo/test_instance_slow_sql_1.php81.php +++ b/tests/integration/pdo/test_instance_slow_sql_1.php81.php @@ -41,7 +41,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -99,7 +99,7 @@ function test_query() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_query(); diff --git a/tests/integration/pdo/test_instance_slow_sql_2.php b/tests/integration/pdo/test_instance_slow_sql_2.php index afa7e5df6..47330ea78 100644 --- a/tests/integration/pdo/test_instance_slow_sql_2.php +++ b/tests/integration/pdo/test_instance_slow_sql_2.php @@ -40,7 +40,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -98,7 +98,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $stmt = $conn->prepare('select * from tables limit 1;'); + $stmt = $conn->prepare('select * from information_schema.tables limit 1;'); tap_assert($stmt->execute(), 'execute slow query'); } diff --git a/tests/integration/pdo/test_instance_slow_sql_2.php81.php b/tests/integration/pdo/test_instance_slow_sql_2.php81.php index 60e833f34..9a7767cf0 100644 --- a/tests/integration/pdo/test_instance_slow_sql_2.php81.php +++ b/tests/integration/pdo/test_instance_slow_sql_2.php81.php @@ -40,7 +40,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -98,7 +98,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $stmt = $conn->prepare('select * from tables limit 1;'); + $stmt = $conn->prepare('select * from information_schema.tables limit 1;'); tap_assert($stmt->execute(), 'execute slow query'); } diff --git a/tests/integration/pdo/test_instance_slow_sql_for_update.php b/tests/integration/pdo/test_instance_slow_sql_for_update.php index 3ba2a18bc..1aac88955 100644 --- a/tests/integration/pdo/test_instance_slow_sql_for_update.php +++ b/tests/integration/pdo/test_instance_slow_sql_for_update.php @@ -36,7 +36,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ? for update;", + "select * from information_schema.tables limit ? for update;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -66,7 +66,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables limit 1 for update;'); + $result = $conn->query('select * from information_schema.tables limit 1 for update;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_instance_slow_sql_lock.php b/tests/integration/pdo/test_instance_slow_sql_lock.php index 798d4272d..ea3db1bc7 100644 --- a/tests/integration/pdo/test_instance_slow_sql_lock.php +++ b/tests/integration/pdo/test_instance_slow_sql_lock.php @@ -37,7 +37,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ? lock in share mode;", + "select * from information_schema.tables limit ? lock in share mode;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -67,7 +67,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables limit 1 lock in share mode;'); + $result = $conn->query('select * from information_schema.tables limit 1 lock in share mode;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_instance_slow_sql_semicolon.php b/tests/integration/pdo/test_instance_slow_sql_semicolon.php index 2c07e0023..c26da78ed 100644 --- a/tests/integration/pdo/test_instance_slow_sql_semicolon.php +++ b/tests/integration/pdo/test_instance_slow_sql_semicolon.php @@ -36,7 +36,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables where engine = ?;", + "select * from information_schema.tables where engine = ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -66,7 +66,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables where engine = \';\';'); + $result = $conn->query('select * from information_schema.tables where engine = \';\';'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_null_options.php b/tests/integration/pdo/test_null_options.php index 16e522a57..ea61e7343 100644 --- a/tests/integration/pdo/test_null_options.php +++ b/tests/integration/pdo/test_null_options.php @@ -32,7 +32,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -85,7 +85,7 @@ function test_slow_sql() { $options = null; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, $options); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_null_options.php81.php b/tests/integration/pdo/test_null_options.php81.php index 528855b81..6f61e3a00 100644 --- a/tests/integration/pdo/test_null_options.php81.php +++ b/tests/integration/pdo/test_null_options.php81.php @@ -32,7 +32,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -85,7 +85,7 @@ function test_slow_sql() { $options = null; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, $options); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_persistent_conn.php b/tests/integration/pdo/test_persistent_conn.php index b44785305..b5453d889 100644 --- a/tests/integration/pdo/test_persistent_conn.php +++ b/tests/integration/pdo/test_persistent_conn.php @@ -32,7 +32,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -86,7 +86,7 @@ function test_slow_sql() $options = array(PDO::ATTR_PERSISTENT => true); $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, $options); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_persistent_conn.php81.php b/tests/integration/pdo/test_persistent_conn.php81.php index ad185d896..2c669bd7f 100644 --- a/tests/integration/pdo/test_persistent_conn.php81.php +++ b/tests/integration/pdo/test_persistent_conn.php81.php @@ -32,7 +32,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -86,7 +86,7 @@ function test_slow_sql() $options = array(PDO::ATTR_PERSISTENT => true); $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, $options); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_prepared_stmt_basic.inc b/tests/integration/pdo/test_prepared_stmt_basic.inc new file mode 100644 index 000000000..4db6fd87b --- /dev/null +++ b/tests/integration/pdo/test_prepared_stmt_basic.inc @@ -0,0 +1,31 @@ +prepare($query); + tap_assert($stmt->execute(), 'execute prepared statement'); +} diff --git a/tests/integration/pdo/test_prepared_stmt_bind_value.inc b/tests/integration/pdo/test_prepared_stmt_bind_value.inc new file mode 100644 index 000000000..6ba2ffd82 --- /dev/null +++ b/tests/integration/pdo/test_prepared_stmt_bind_value.inc @@ -0,0 +1,32 @@ +prepare($query); + $stmt->bindValue(1, "missing"); + tap_assert($stmt->execute(), 'execute prepared statement'); +} diff --git a/tests/integration/pdo/test_prepared_stmt_params.php b/tests/integration/pdo/test_prepared_stmt_params.php index cd097e04f..7bb92e7c3 100644 --- a/tests/integration/pdo/test_prepared_stmt_params.php +++ b/tests/integration/pdo/test_prepared_stmt_params.php @@ -36,7 +36,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables where table_name = ? limit ?;", + "select * from information_schema.tables where table_name = ? limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -88,7 +88,7 @@ function test_prepared_statement() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $stmt = $conn->prepare('select * from tables where table_name = ? limit 1;'); + $stmt = $conn->prepare('select * from information_schema.tables where table_name = ? limit 1;'); $stmt->bindValue(1, "missing"); tap_assert($stmt->execute(), 'execute prepared statement with a param'); } diff --git a/tests/integration/pdo/test_prepared_stmt_params.php81.php b/tests/integration/pdo/test_prepared_stmt_params.php81.php index 001b38dd3..5c1b40c99 100644 --- a/tests/integration/pdo/test_prepared_stmt_params.php81.php +++ b/tests/integration/pdo/test_prepared_stmt_params.php81.php @@ -36,7 +36,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables where table_name = ? limit ?;", + "select * from information_schema.tables where table_name = ? limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -88,7 +88,7 @@ function test_prepared_statement() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $stmt = $conn->prepare('select * from tables where table_name = ? limit 1;'); + $stmt = $conn->prepare('select * from information_schema.tables where table_name = ? limit 1;'); $stmt->bindValue(1, "missing"); tap_assert($stmt->execute(), 'execute prepared statement with a param'); } diff --git a/tests/integration/pdo/test_query_1_arg.inc b/tests/integration/pdo/test_query_1_arg.inc new file mode 100644 index 000000000..104405786 --- /dev/null +++ b/tests/integration/pdo/test_query_1_arg.inc @@ -0,0 +1,51 @@ +exec("CREATE TABLE test (id INT, description VARCHAR(10));"), 'create table'); + + tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert one'); + tap_equal(1, $conn->exec("INSERT INTO test VALUES (2, 'two');"), 'insert two'); + tap_equal(1, $conn->exec("INSERT INTO test VALUES (3, 'three');"), 'insert three'); + + $expected = array( + array('id' => 1, 'description' => 'one'), + array('id' => 2, 'description' => 'two'), + array('id' => 3, 'description' => 'three') + ); + + $result = $conn->query('SELECT * FROM test;'); + $actual = $result->fetchAll(PDO::FETCH_ASSOC); + $result->closeCursor(); + // normalize id to int type + array_walk($actual, function (&$row, $key) { + $row['id'] = intval($row['id']); + }); + tap_equal($expected, $actual, 'query (1-arg)'); + + tap_equal($want_drop_table_result, $conn->exec("DROP TABLE test;"), 'drop table'); +} diff --git a/tests/integration/pdo/test_query_fetch_class.inc b/tests/integration/pdo/test_query_fetch_class.inc new file mode 100644 index 000000000..4aef4c76f --- /dev/null +++ b/tests/integration/pdo/test_query_fetch_class.inc @@ -0,0 +1,44 @@ +exec("CREATE TABLE test (id INT, description VARCHAR(10));"), 'create table'); + tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert row'); + + $expected = new Row(); + $expected->id = '1'; + $expected->description = 'one'; + + $actual = $conn->query('SELECT * FROM test;', PDO::FETCH_CLASS, 'Row')->fetch(); + tap_assert($expected == $actual, 'fetch row as object'); + + tap_equal($want_drop_table_result, $conn->exec("DROP TABLE test;"), 'drop table'); +} diff --git a/tests/integration/pdo/test_query_fetch_column.inc b/tests/integration/pdo/test_query_fetch_column.inc new file mode 100644 index 000000000..df1c590e5 --- /dev/null +++ b/tests/integration/pdo/test_query_fetch_column.inc @@ -0,0 +1,40 @@ +exec("CREATE TABLE test (id INT, description VARCHAR(10));"), 'create table'); + + tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert one'); + tap_equal(1, $conn->exec("INSERT INTO test VALUES (2, 'two');"), 'insert two'); + tap_equal(1, $conn->exec("INSERT INTO test VALUES (3, 'three');"), 'insert three'); + + $result = $conn->query('SELECT * FROM test;', PDO::FETCH_COLUMN, 1); + $actual = $result->fetchAll(PDO::FETCH_ASSOC); + $result->closeCursor(); + tap_equal(3, count($actual), 'fetch column'); + + tap_equal($want_drop_table_result, $conn->exec("DROP TABLE test;"), 'drop table'); +} diff --git a/tests/integration/pdo/test_query_fetch_into.inc b/tests/integration/pdo/test_query_fetch_into.inc new file mode 100644 index 000000000..2cc144881 --- /dev/null +++ b/tests/integration/pdo/test_query_fetch_into.inc @@ -0,0 +1,45 @@ +exec("CREATE TABLE test (id INT, description VARCHAR(10));"), 'create table'); + tap_equal(1, $conn->exec("INSERT INTO test VALUES (1, 'one');"), 'insert row'); + + $expected = new Row(); + $expected->id = '1'; + $expected->description = 'one'; + + $actual = new Row(); + $conn->query('SELECT * FROM test;', PDO::FETCH_INTO, $actual)->fetch(); + tap_assert($expected == $actual, 'fetch row into object'); + + tap_equal($want_drop_table_result, $conn->exec("DROP TABLE test;"), 'drop table'); +} diff --git a/tests/integration/pdo/test_slow_sql_1.php b/tests/integration/pdo/test_slow_sql_1.php index 84e0aa06c..86b4aea7f 100644 --- a/tests/integration/pdo/test_slow_sql_1.php +++ b/tests/integration/pdo/test_slow_sql_1.php @@ -31,7 +31,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -83,7 +83,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_slow_sql_1.php81.php b/tests/integration/pdo/test_slow_sql_1.php81.php index 6d5b4064e..e420b7b97 100644 --- a/tests/integration/pdo/test_slow_sql_1.php81.php +++ b/tests/integration/pdo/test_slow_sql_1.php81.php @@ -31,7 +31,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -83,7 +83,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_slow_sql_2.php b/tests/integration/pdo/test_slow_sql_2.php index f2f928385..2c3bb54d2 100644 --- a/tests/integration/pdo/test_slow_sql_2.php +++ b/tests/integration/pdo/test_slow_sql_2.php @@ -35,7 +35,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -87,7 +87,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $stmt = $conn->prepare('select * from tables limit 1;'); + $stmt = $conn->prepare('select * from information_schema.tables limit 1;'); tap_assert($stmt->execute(), 'execute slow query'); } diff --git a/tests/integration/pdo/test_slow_sql_2.php81.php b/tests/integration/pdo/test_slow_sql_2.php81.php index a80a43510..f52008c2c 100644 --- a/tests/integration/pdo/test_slow_sql_2.php81.php +++ b/tests/integration/pdo/test_slow_sql_2.php81.php @@ -35,7 +35,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ?;", + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -87,7 +87,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $stmt = $conn->prepare('select * from tables limit 1;'); + $stmt = $conn->prepare('select * from information_schema.tables limit 1;'); tap_assert($stmt->execute(), 'execute slow query'); } diff --git a/tests/integration/pdo/test_slow_sql_for_update.php b/tests/integration/pdo/test_slow_sql_for_update.php index 2a074b689..63e75d373 100644 --- a/tests/integration/pdo/test_slow_sql_for_update.php +++ b/tests/integration/pdo/test_slow_sql_for_update.php @@ -28,7 +28,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ? for update;", + "select * from information_schema.tables limit ? for update;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -51,7 +51,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables limit 1 for update;'); + $result = $conn->query('select * from information_schema.tables limit 1 for update;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_slow_sql_lock.php b/tests/integration/pdo/test_slow_sql_lock.php index c87464ad3..7f1d07722 100644 --- a/tests/integration/pdo/test_slow_sql_lock.php +++ b/tests/integration/pdo/test_slow_sql_lock.php @@ -28,7 +28,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables limit ? lock in share mode;", + "select * from information_schema.tables limit ? lock in share mode;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -51,7 +51,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables limit 1 lock in share mode;'); + $result = $conn->query('select * from information_schema.tables limit 1 lock in share mode;'); } test_slow_sql(); diff --git a/tests/integration/pdo/test_slow_sql_semicolon.php b/tests/integration/pdo/test_slow_sql_semicolon.php index 87901b7e5..4f88e76d5 100644 --- a/tests/integration/pdo/test_slow_sql_semicolon.php +++ b/tests/integration/pdo/test_slow_sql_semicolon.php @@ -28,7 +28,7 @@ "OtherTransaction/php__FILE__", "", "?? SQL id", - "select * from tables where engine = ?;", + "select * from information_schema.tables where engine = ?;", "Datastore/statement/MySQL/tables/select", 1, "?? total time", @@ -51,7 +51,7 @@ function test_slow_sql() { global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD); - $result = $conn->query('select * from tables where engine = \';\';'); + $result = $conn->query('select * from information_schema.tables where engine = \';\';'); } test_slow_sql(); diff --git a/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php b/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php index 91b1420be..56e161179 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php @@ -14,6 +14,9 @@ if (version_compare(PHP_VERSION, "7.0", "<")) { die("skip: CLM for PHP 5 not supported\n"); } +if (version_compare(PHP_VERSION, "8.4", ">=")) { + die("skip: newer test for PHP 8.4+\n"); +} */ /*INI @@ -92,7 +95,7 @@ { "error.message": "foo", "error.class": "E_USER_ERROR", - "code.lineno": 136, + "code.lineno": 139, "code.filepath": "__FILE__", "code.function": "a" } @@ -113,7 +116,7 @@ }, {}, { - "code.lineno": 130, + "code.lineno": 133, "code.filepath": "__FILE__", "code.function": "{closure}" } diff --git a/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php5.php b/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php84.php similarity index 80% rename from tests/integration/span_events/test_span_events_are_created_upon_caught_error.php5.php rename to tests/integration/span_events/test_span_events_are_created_upon_caught_error.php84.php index 22a82caa9..fabe4bddd 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php5.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_caught_error.php84.php @@ -7,6 +7,14 @@ /*DESCRIPTION Test that span events are correctly created from any eligible segment, even when an error is generated and handled. +PHP 8.4+ names closures differently. +*/ + +/*SKIPIF +=")) { + die("skip: newer test for PHP 8.4\n"); +} */ /*INI @@ -92,7 +95,7 @@ { "error.message": "foo", "error.class": "E_USER_ERROR", - "code.lineno": 108, + "code.lineno": 111, "code.filepath": "__FILE__", "code.function": "a" } diff --git a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php5.php b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php5.php index 5353e0da0..3e17f5371 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php5.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php5.php @@ -19,6 +19,13 @@ newrelic.code_level_metrics.enabled=false */ +/*SKIPIF +=")) { + die("skip: newer test for PHP 8.4\n"); +} +*/ + /*EXPECT_SPAN_EVENTS [ "?? agent run id", diff --git a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php84.php b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php84.php new file mode 100644 index 000000000..b56ef56a2 --- /dev/null +++ b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_error.php84.php @@ -0,0 +1,122 @@ + 'FakeDB', + ) +); +a(); diff --git a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_handled_exception.php b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_handled_exception.php index 7670f8a27..24d3e6da2 100644 --- a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_handled_exception.php +++ b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_handled_exception.php @@ -16,6 +16,9 @@ if (version_compare(PHP_VERSION, "8.0", "<")) { die("skip: test for oapi agent only\n"); } +if (version_compare(PHP_VERSION, "8.4", ">=")) { + die("skip: newer test for PHP 8.4+\n"); +} */ /*INI diff --git a/tests/integration/span_events/test_span_events_are_created_upon_uncaught_handled_exception.php84.php b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_handled_exception.php84.php new file mode 100644 index 000000000..c9e6a3455 --- /dev/null +++ b/tests/integration/span_events/test_span_events_are_created_upon_uncaught_handled_exception.php84.php @@ -0,0 +1,183 @@ + 'FakeDB', + ) +); +a(); + +echo 'this should never be printed'; diff --git a/tests/lasp/suite-least-secure/test_slow_sql_on.php b/tests/lasp/suite-least-secure/test_slow_sql_on.php index e4b693b0b..003595b14 100644 --- a/tests/lasp/suite-least-secure/test_slow_sql_on.php +++ b/tests/lasp/suite-least-secure/test_slow_sql_on.php @@ -31,8 +31,8 @@ [ "OtherTransaction/php__FILE__", "\u003cunknown\u003e", - 2691358128, - "select * from tables limit ?;", + 2279837883, + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", "??", "??", @@ -85,7 +85,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/lasp/suite-least-secure/test_slow_sql_on.php81.php b/tests/lasp/suite-least-secure/test_slow_sql_on.php81.php index b4e678a8b..a9696beb7 100644 --- a/tests/lasp/suite-least-secure/test_slow_sql_on.php81.php +++ b/tests/lasp/suite-least-secure/test_slow_sql_on.php81.php @@ -31,8 +31,8 @@ [ "OtherTransaction/php__FILE__", "\u003cunknown\u003e", - 2691358128, - "select * from tables limit ?;", + 2279837883, + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", "??", "??", @@ -85,7 +85,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/lasp/suite-most-secure/test_slow_sql_off.php b/tests/lasp/suite-most-secure/test_slow_sql_off.php index e5e252eea..e464fd0d0 100644 --- a/tests/lasp/suite-most-secure/test_slow_sql_off.php +++ b/tests/lasp/suite-most-secure/test_slow_sql_off.php @@ -35,7 +35,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/lasp/suite-random-2/test_slow_sql_on.php b/tests/lasp/suite-random-2/test_slow_sql_on.php index b68fb481f..c1e86a5fa 100644 --- a/tests/lasp/suite-random-2/test_slow_sql_on.php +++ b/tests/lasp/suite-random-2/test_slow_sql_on.php @@ -30,8 +30,8 @@ [ "OtherTransaction/php__FILE__", "\u003cunknown\u003e", - 2691358128, - "select * from tables limit ?;", + 2279837883, + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", "??", "??", @@ -84,7 +84,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/lasp/suite-random-2/test_slow_sql_on.php81.php b/tests/lasp/suite-random-2/test_slow_sql_on.php81.php index d229271ef..c25195200 100644 --- a/tests/lasp/suite-random-2/test_slow_sql_on.php81.php +++ b/tests/lasp/suite-random-2/test_slow_sql_on.php81.php @@ -30,8 +30,8 @@ [ "OtherTransaction/php__FILE__", "\u003cunknown\u003e", - 2691358128, - "select * from tables limit ?;", + 2279837883, + "select * from information_schema.tables limit ?;", "Datastore/statement/MySQL/tables/select", "??", "??", @@ -84,7 +84,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/lasp/suite-random-3/test_slow_sql_off.php b/tests/lasp/suite-random-3/test_slow_sql_off.php index 18c3c7f84..087f130bb 100644 --- a/tests/lasp/suite-random-3/test_slow_sql_off.php +++ b/tests/lasp/suite-random-3/test_slow_sql_off.php @@ -34,7 +34,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/lasp/suite-random-3/test_slow_sql_on.php b/tests/lasp/suite-random-3/test_slow_sql_on.php index d55b78edf..6ec54ea93 100644 --- a/tests/lasp/suite-random-3/test_slow_sql_on.php +++ b/tests/lasp/suite-random-3/test_slow_sql_on.php @@ -34,7 +34,7 @@ function test_slow_sql() global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, array()); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } test_slow_sql(); diff --git a/tests/regression/test_php_1179_pdo_options_crash.php b/tests/regression/test_php_1179_pdo_options_crash.php index e35ca7f0a..9b6419337 100644 --- a/tests/regression/test_php_1179_pdo_options_crash.php +++ b/tests/regression/test_php_1179_pdo_options_crash.php @@ -59,7 +59,7 @@ function test_slow_sql(array $options) global $PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD; $conn = new PDO($PDO_MYSQL_DSN, $MYSQL_USER, $MYSQL_PASSWD, $options); - $result = $conn->query('select * from tables limit 1;'); + $result = $conn->query('select * from information_schema.tables limit 1;'); } $shared_options = array(PDO::ATTR_PERSISTENT => true);