Skip to content

Commit 2f79c48

Browse files
authored
Merge pull request #1110 from newrelic/dev
Release 12.0
2 parents 765888d + eb011f0 commit 2f79c48

File tree

295 files changed

+711
-11802
lines changed

Some content is hidden

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

295 files changed

+711
-11802
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
11.10.0
1+
12.0.0

agent/config.m4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,13 @@ if test "$PHP_NEWRELIC" = "yes"; then
223223
php_user_instrument_wraprec_hashmap.c \
224224
php_user_instrument_hashmap.c php_vm.c php_wrapper.c"
225225
FRAMEWORKS="fw_cakephp.c fw_codeigniter.c fw_drupal8.c \
226-
fw_drupal.c fw_drupal_common.c fw_joomla.c fw_kohana.c \
226+
fw_drupal.c fw_drupal_common.c fw_joomla.c \
227227
fw_laminas3.c fw_laravel.c fw_laravel_queue.c fw_lumen.c \
228228
fw_magento1.c fw_magento2.c fw_magento_common.c fw_mediawiki.c \
229-
fw_silex.c fw_slim.c fw_support.c fw_symfony4.c fw_symfony2.c \
230-
fw_symfony.c fw_symfony_common.c fw_wordpress.c fw_yii.c \
231-
fw_zend2.c fw_zend.c"
232-
LIBRARIES="lib_aws_sdk_php.c lib_monolog.c lib_doctrine2.c lib_guzzle3.c \
229+
fw_slim.c fw_support.c fw_symfony4.c \
230+
fw_symfony_common.c fw_wordpress.c fw_yii.c \
231+
fw_zend3.c"
232+
LIBRARIES="lib_aws_sdk_php.c lib_monolog.c lib_doctrine2.c \
233233
lib_guzzle4.c lib_guzzle6.c lib_guzzle_common.c \
234234
lib_mongodb.c lib_phpunit.c lib_predis.c lib_zend_http.c \
235235
lib_composer.c lib_php_amqplib.c"

agent/fw_codeigniter.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "util_strings.h"
1616

1717
zend_op_array* nr_codeigniter_get_topmost_user_op_array(TSRMLS_D) {
18-
#ifdef PHP7
1918
zend_execute_data* ed = NULL;
2019

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

2928
return NULL;
30-
#else
31-
return EG(current_execute_data)->op_array;
32-
#endif /* PHP7 */
3329
}
3430

3531
/*

agent/fw_drupal8.c

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,7 @@ static int nr_drupal8_is_function_in_call_stack(const char* function,
197197
trace = nr_php_zval_alloc();
198198

199199
/* Grab the actual backtrace. */
200-
#if ZEND_MODULE_API_NO >= ZEND_5_4_X_API_NO
201200
zend_fetch_debug_backtrace(trace, 0, 1, 0 TSRMLS_CC);
202-
#else /* PHP < 5.4 */
203-
zend_fetch_debug_backtrace(trace, 0, 1 TSRMLS_CC);
204-
#endif
205201

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

611607
static bool nr_is_invalid_key_val_arr(nr_php_string_hash_key_t* key,
612-
zval* val) {
613-
if (NULL == key || 0 == ZEND_STRING_LEN(key)
614-
|| 0 == nr_php_is_zval_valid_array(val)
608+
zval* val,
609+
const char* key_ident) {
610+
if (NULL == key || 0 == ZEND_STRING_LEN(key)) {
611+
nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[%s]: invalid key",
612+
key_ident);
613+
return true;
614+
}
615+
616+
if (0 == nr_php_is_zval_valid_array(val)
615617
|| 0 == zend_hash_num_elements(Z_ARRVAL_P(val))) {
618+
nrl_warning(NRL_FRAMEWORK,
619+
"hookImplementationsMap[%s]: invalid value for key '%s'",
620+
key_ident, NRSAFESTR(ZEND_STRING_VALUE(key)));
616621
return true;
617-
} else {
618-
return false;
619622
}
623+
624+
return false;
620625
}
621626

622627
/*
@@ -650,25 +655,27 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) {
650655

651656
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), hook_key,
652657
hook_val) {
653-
if (nr_is_invalid_key_val_arr(hook_key, hook_val)) {
654-
nrl_warning(NRL_FRAMEWORK,
655-
"hookImplementationsMap[hook]: invalid key or value");
658+
if (nr_is_invalid_key_val_arr(hook_key, hook_val, "hook")) {
656659
return false;
657660
}
658661

659662
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_val), class_key, class_val) {
660-
if (nr_is_invalid_key_val_arr(class_key, class_val)) {
661-
nrl_warning(NRL_FRAMEWORK,
662-
"hookImplementationsMap[class]: invalid key or value");
663+
if (nr_is_invalid_key_val_arr(class_key, class_val, "class")) {
663664
return false;
664665
}
665666

666667
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(class_val), method_key,
667668
module_val) {
668-
if (NULL == method_key
669-
|| 0 == nr_php_is_zval_valid_string(module_val)) {
669+
if (NULL == method_key) {
670670
nrl_warning(NRL_FRAMEWORK,
671-
"hookImplementationsMap[method]: invalid key or value");
671+
"hookImplementationsMap[method]: invalid key");
672+
return false;
673+
}
674+
if (0 == nr_php_is_zval_valid_string(module_val)) {
675+
nrl_warning(
676+
NRL_FRAMEWORK,
677+
"hookImplementationsMap[method]: invalid value for key '%s'",
678+
NRSAFESTR(ZEND_STRING_VALUE(method_key)));
672679
return false;
673680
}
674681

agent/fw_hooks.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,22 @@ extern void nr_drupal_enable(TSRMLS_D);
2020

2121
extern void nr_drupal8_enable(TSRMLS_D);
2222
extern void nr_joomla_enable(TSRMLS_D);
23-
extern void nr_kohana_enable(TSRMLS_D);
2423
extern void nr_laminas3_enable(TSRMLS_D);
2524
extern void nr_laravel_enable(TSRMLS_D);
2625
extern void nr_lumen_enable(TSRMLS_D);
2726
extern void nr_magento1_enable(TSRMLS_D);
2827
extern void nr_magento2_enable(TSRMLS_D);
2928
extern void nr_mediawiki_enable(TSRMLS_D);
30-
extern void nr_symfony1_enable(TSRMLS_D);
31-
extern void nr_symfony2_enable(TSRMLS_D);
3229
extern void nr_symfony4_enable(TSRMLS_D);
33-
extern void nr_silex_enable(TSRMLS_D);
3430
extern void nr_slim_enable(TSRMLS_D);
3531
extern void nr_wordpress_enable(TSRMLS_D);
3632
extern void nr_yii1_enable(TSRMLS_D);
3733
extern void nr_yii2_enable(TSRMLS_D);
38-
extern void nr_zend_enable(TSRMLS_D);
39-
extern void nr_fw_zend2_enable(TSRMLS_D);
34+
extern void nr_fw_zend3_enable(TSRMLS_D);
4035

4136
/* Libraries. */
4237
extern void nr_aws_sdk_php_enable();
4338
extern void nr_doctrine2_enable(TSRMLS_D);
44-
extern void nr_guzzle3_enable(TSRMLS_D);
4539
extern void nr_guzzle4_enable(TSRMLS_D);
4640
extern void nr_guzzle6_enable(TSRMLS_D);
4741
extern void nr_laminas_http_enable(TSRMLS_D);

agent/fw_kohana.c

Lines changed: 0 additions & 113 deletions
This file was deleted.

agent/fw_laminas3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/*
1919
* Laminas is a rebranding of Zend, but the logic remains the same,
2020
* it is simply a name change and corresponds directly to Zend 3.x.
21-
* Compare to `fw_zend2.c`
21+
* Compare to `fw_zend3.c`
2222
*
2323
* How Laminas nee Zend Routing Works
2424
* =====================

agent/fw_laravel.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,8 @@ static void nr_laravel_name_transaction(zval* router, zval* request TSRMLS_DC) {
490490
*
491491
*/
492492
NR_PHP_WRAPPER(nr_laravel5_exception_render) {
493-
#if ZEND_MODULE_API_NO >= ZEND_5_4_X_API_NO
494493
const char* class_name = NULL;
495494
const char* ignored = NULL;
496-
#else
497-
char* class_name = NULL;
498-
char* ignored = NULL;
499-
#endif /* PHP >= 5.4 */
500495

501496
char* name = NULL;
502497

agent/fw_laravel_queue.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_process) {
620620
if (EG(exception)) {
621621
zval* exception_zval = NULL;
622622

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

641640
ZVAL_OBJ(&exception, EG(exception));
642641
exception_zval = &exception;
643-
#else
644-
/*
645-
* On PHP 5, the exception is just a regular old zval.
646-
*/
647-
exception_zval = EG(exception);
648-
#endif /* PHP7+ */
649642

650643
nr_php_error_record_exception(
651644
NRPRG(txn), exception_zval, NR_PHP_ERROR_PRIORITY_UNCAUGHT_EXCEPTION,
@@ -835,13 +828,8 @@ NR_PHP_WRAPPER(nr_laravel_queue_queue_createpayload) {
835828
/*
836829
* Finally, we change the string in the return value to our new JSON.
837830
*/
838-
#if ZEND_MODULE_API_NO >= ZEND_7_0_X_API_NO /* PHP 7.0+ */
839831
zend_string_free(Z_STR_P(*retval_ptr));
840832
Z_STR_P(*retval_ptr) = zend_string_copy(Z_STR_P(json));
841-
#else
842-
efree(Z_STRVAL_PP(retval_ptr));
843-
nr_php_zval_str_len(*retval_ptr, Z_STRVAL_P(json), Z_STRLEN_P(json));
844-
#endif /* PHP7+ */
845833

846834
end:
847835
nr_php_zval_free(&payload);

agent/fw_lumen.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,8 @@ NR_PHP_WRAPPER(nr_lumen_exception) {
166166

167167
NR_PHP_WRAPPER_REQUIRE_FRAMEWORK(NR_FW_LUMEN);
168168

169-
#if ZEND_MODULE_API_NO >= ZEND_5_4_X_API_NO
170169
const char* class_name = NULL;
171170
const char* ignored = NULL;
172-
#else
173-
char* class_name = NULL;
174-
char* ignored = NULL;
175-
#endif /* PHP >= 5.4 */
176171

177172
char* name = NULL;
178173

0 commit comments

Comments
 (0)