Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.10.0
12.0.0
10 changes: 5 additions & 5 deletions agent/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,13 @@ if test "$PHP_NEWRELIC" = "yes"; then
php_user_instrument_wraprec_hashmap.c \
php_user_instrument_hashmap.c php_vm.c php_wrapper.c"
FRAMEWORKS="fw_cakephp.c fw_codeigniter.c fw_drupal8.c \
fw_drupal.c fw_drupal_common.c fw_joomla.c fw_kohana.c \
fw_drupal.c fw_drupal_common.c fw_joomla.c \
fw_laminas3.c fw_laravel.c fw_laravel_queue.c fw_lumen.c \
fw_magento1.c fw_magento2.c fw_magento_common.c fw_mediawiki.c \
fw_silex.c fw_slim.c fw_support.c fw_symfony4.c fw_symfony2.c \
fw_symfony.c fw_symfony_common.c fw_wordpress.c fw_yii.c \
fw_zend2.c fw_zend.c"
LIBRARIES="lib_aws_sdk_php.c lib_monolog.c lib_doctrine2.c lib_guzzle3.c \
fw_slim.c fw_support.c fw_symfony4.c \
fw_symfony_common.c fw_wordpress.c fw_yii.c \
fw_zend3.c"
LIBRARIES="lib_aws_sdk_php.c lib_monolog.c lib_doctrine2.c \
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 lib_php_amqplib.c"
Expand Down
4 changes: 0 additions & 4 deletions agent/fw_codeigniter.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "util_strings.h"

zend_op_array* nr_codeigniter_get_topmost_user_op_array(TSRMLS_D) {
#ifdef PHP7
zend_execute_data* ed = NULL;

for (ed = EG(current_execute_data); ed; ed = ed->prev_execute_data) {
Expand All @@ -27,9 +26,6 @@ zend_op_array* nr_codeigniter_get_topmost_user_op_array(TSRMLS_D) {
}

return NULL;
#else
return EG(current_execute_data)->op_array;
#endif /* PHP7 */
}

/*
Expand Down
43 changes: 25 additions & 18 deletions agent/fw_drupal8.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,7 @@ static int nr_drupal8_is_function_in_call_stack(const char* function,
trace = nr_php_zval_alloc();

/* Grab the actual backtrace. */
#if ZEND_MODULE_API_NO >= ZEND_5_4_X_API_NO
zend_fetch_debug_backtrace(trace, 0, 1, 0 TSRMLS_CC);
#else /* PHP < 5.4 */
zend_fetch_debug_backtrace(trace, 0, 1 TSRMLS_CC);
#endif

if (!nr_php_is_zval_valid_array(trace)) {
nrl_error(NRL_TXN, "%s: trace should never not be an array", __func__);
Expand Down Expand Up @@ -609,14 +605,23 @@ NR_PHP_WRAPPER_END
#endif // OAPI

static bool nr_is_invalid_key_val_arr(nr_php_string_hash_key_t* key,
zval* val) {
if (NULL == key || 0 == ZEND_STRING_LEN(key)
|| 0 == nr_php_is_zval_valid_array(val)
zval* val,
const char* key_ident) {
if (NULL == key || 0 == ZEND_STRING_LEN(key)) {
nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[%s]: invalid key",
key_ident);
return true;
}

if (0 == nr_php_is_zval_valid_array(val)
|| 0 == zend_hash_num_elements(Z_ARRVAL_P(val))) {
nrl_warning(NRL_FRAMEWORK,
"hookImplementationsMap[%s]: invalid value for key '%s'",
key_ident, NRSAFESTR(ZEND_STRING_VALUE(key)));
return true;
} else {
return false;
}

return false;
}

/*
Expand Down Expand Up @@ -650,25 +655,27 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) {

ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), hook_key,
hook_val) {
if (nr_is_invalid_key_val_arr(hook_key, hook_val)) {
nrl_warning(NRL_FRAMEWORK,
"hookImplementationsMap[hook]: invalid key or value");
if (nr_is_invalid_key_val_arr(hook_key, hook_val, "hook")) {
return false;
}

ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_val), class_key, class_val) {
if (nr_is_invalid_key_val_arr(class_key, class_val)) {
nrl_warning(NRL_FRAMEWORK,
"hookImplementationsMap[class]: invalid key or value");
if (nr_is_invalid_key_val_arr(class_key, class_val, "class")) {
return false;
}

ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(class_val), method_key,
module_val) {
if (NULL == method_key
|| 0 == nr_php_is_zval_valid_string(module_val)) {
if (NULL == method_key) {
nrl_warning(NRL_FRAMEWORK,
"hookImplementationsMap[method]: invalid key or value");
"hookImplementationsMap[method]: invalid key");
return false;
}
if (0 == nr_php_is_zval_valid_string(module_val)) {
nrl_warning(
NRL_FRAMEWORK,
"hookImplementationsMap[method]: invalid value for key '%s'",
NRSAFESTR(ZEND_STRING_VALUE(method_key)));
return false;
}

Expand Down
8 changes: 1 addition & 7 deletions agent/fw_hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,22 @@ extern void nr_drupal_enable(TSRMLS_D);

extern void nr_drupal8_enable(TSRMLS_D);
extern void nr_joomla_enable(TSRMLS_D);
extern void nr_kohana_enable(TSRMLS_D);
extern void nr_laminas3_enable(TSRMLS_D);
extern void nr_laravel_enable(TSRMLS_D);
extern void nr_lumen_enable(TSRMLS_D);
extern void nr_magento1_enable(TSRMLS_D);
extern void nr_magento2_enable(TSRMLS_D);
extern void nr_mediawiki_enable(TSRMLS_D);
extern void nr_symfony1_enable(TSRMLS_D);
extern void nr_symfony2_enable(TSRMLS_D);
extern void nr_symfony4_enable(TSRMLS_D);
extern void nr_silex_enable(TSRMLS_D);
extern void nr_slim_enable(TSRMLS_D);
extern void nr_wordpress_enable(TSRMLS_D);
extern void nr_yii1_enable(TSRMLS_D);
extern void nr_yii2_enable(TSRMLS_D);
extern void nr_zend_enable(TSRMLS_D);
extern void nr_fw_zend2_enable(TSRMLS_D);
extern void nr_fw_zend3_enable(TSRMLS_D);

/* Libraries. */
extern void nr_aws_sdk_php_enable();
extern void nr_doctrine2_enable(TSRMLS_D);
extern void nr_guzzle3_enable(TSRMLS_D);
extern void nr_guzzle4_enable(TSRMLS_D);
extern void nr_guzzle6_enable(TSRMLS_D);
extern void nr_laminas_http_enable(TSRMLS_D);
Expand Down
113 changes: 0 additions & 113 deletions agent/fw_kohana.c

This file was deleted.

2 changes: 1 addition & 1 deletion agent/fw_laminas3.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/*
* Laminas is a rebranding of Zend, but the logic remains the same,
* it is simply a name change and corresponds directly to Zend 3.x.
* Compare to `fw_zend2.c`
* Compare to `fw_zend3.c`
*
* How Laminas nee Zend Routing Works
* =====================
Expand Down
5 changes: 0 additions & 5 deletions agent/fw_laravel.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,8 @@ static void nr_laravel_name_transaction(zval* router, zval* request TSRMLS_DC) {
*
*/
NR_PHP_WRAPPER(nr_laravel5_exception_render) {
#if ZEND_MODULE_API_NO >= ZEND_5_4_X_API_NO
const char* class_name = NULL;
const char* ignored = NULL;
#else
char* class_name = NULL;
char* ignored = NULL;
#endif /* PHP >= 5.4 */

char* name = NULL;

Expand Down
12 changes: 0 additions & 12 deletions agent/fw_laravel_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,6 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_process) {
if (EG(exception)) {
zval* exception_zval = NULL;

#if ZEND_MODULE_API_NO >= ZEND_7_0_X_API_NO /* PHP 7.0+ */
/*
* On PHP 7, EG(exception) is stored as a zend_object, and is only wrapped
* in a zval when it actually needs to be. Unfortunately, our error handling
Expand All @@ -640,12 +639,6 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_process) {

ZVAL_OBJ(&exception, EG(exception));
exception_zval = &exception;
#else
/*
* On PHP 5, the exception is just a regular old zval.
*/
exception_zval = EG(exception);
#endif /* PHP7+ */

nr_php_error_record_exception(
NRPRG(txn), exception_zval, NR_PHP_ERROR_PRIORITY_UNCAUGHT_EXCEPTION,
Expand Down Expand Up @@ -835,13 +828,8 @@ NR_PHP_WRAPPER(nr_laravel_queue_queue_createpayload) {
/*
* Finally, we change the string in the return value to our new JSON.
*/
#if ZEND_MODULE_API_NO >= ZEND_7_0_X_API_NO /* PHP 7.0+ */
zend_string_free(Z_STR_P(*retval_ptr));
Z_STR_P(*retval_ptr) = zend_string_copy(Z_STR_P(json));
#else
efree(Z_STRVAL_PP(retval_ptr));
nr_php_zval_str_len(*retval_ptr, Z_STRVAL_P(json), Z_STRLEN_P(json));
#endif /* PHP7+ */

end:
nr_php_zval_free(&payload);
Expand Down
5 changes: 0 additions & 5 deletions agent/fw_lumen.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,8 @@ NR_PHP_WRAPPER(nr_lumen_exception) {

NR_PHP_WRAPPER_REQUIRE_FRAMEWORK(NR_FW_LUMEN);

#if ZEND_MODULE_API_NO >= ZEND_5_4_X_API_NO
const char* class_name = NULL;
const char* ignored = NULL;
#else
char* class_name = NULL;
char* ignored = NULL;
#endif /* PHP >= 5.4 */

char* name = NULL;

Expand Down
Loading
Loading