Skip to content

Commit 6223b1a

Browse files
committed
fixup! optimize library/framework detection for PHPs 8.0+
After optimization of when library/framework detection is happening, file execution no longer increments execute_count - only user function execution increments it.
1 parent f855542 commit 6223b1a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

agent/tests/test_txn.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ static void test_handle_fpm_error(TSRMLS_D) {
5050

5151
nr_txn_set_path(NULL, NRPRG(txn), "foo", NR_PATH_TYPE_URI,
5252
NR_NOT_OK_TO_OVERWRITE);
53+
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO /* PHP8+ */
54+
// file execution no longer increments execute_count on PHPs 8.0+
55+
// only user function calls do increment execute_count:
56+
tlib_php_request_eval("function f() {$a = 1 + 1;}\n"
57+
"f(); // create a PHP call frame" TSRMLS_CC);
58+
#else
5359
tlib_php_request_eval("$a = 1 + 1; // create a PHP call frame" TSRMLS_CC);
60+
#endif
5461
nr_php_txn_handle_fpm_error(NRPRG(txn) TSRMLS_CC);
5562
tlib_pass_if_str_equal("transaction path should be unchanged", "foo",
5663
NRTXN(path));

0 commit comments

Comments
 (0)