@@ -151,8 +151,12 @@ static void nr_php_instrument_delegate(nrinternalfn_t* wraprec,
151
151
int nr_zend_call_old_handler (nrphpfn_t oldhandler ,
152
152
INTERNAL_FUNCTION_PARAMETERS ) {
153
153
volatile int zcaught = 0 ;
154
- zend_try { oldhandler (INTERNAL_FUNCTION_PARAM_PASSTHRU ); }
155
- zend_catch { zcaught = 1 ; }
154
+ zend_try {
155
+ oldhandler (INTERNAL_FUNCTION_PARAM_PASSTHRU );
156
+ }
157
+ zend_catch {
158
+ zcaught = 1 ;
159
+ }
156
160
zend_end_try ();
157
161
return zcaught ;
158
162
}
@@ -333,7 +337,8 @@ static void record_mysql_error(TSRMLS_D) {
333
337
334
338
errdup = nr_strndup (errormsgstr , errormsglen );
335
339
stack_json = nr_php_backtrace_to_json (0 TSRMLS_CC );
336
- nr_txn_record_error (NRPRG (txn ), errprio , true, errdup , "MysqlError" , stack_json );
340
+ nr_txn_record_error (NRPRG (txn ), errprio , true, errdup , "MysqlError" ,
341
+ stack_json );
337
342
nr_free (errdup );
338
343
nr_free (stack_json );
339
344
@@ -647,17 +652,18 @@ NR_INNER_WRAPPER(mysqli_construct) {
647
652
648
653
#if ZEND_MODULE_API_NO >= ZEND_8_1_X_API_NO
649
654
bool port_is_null = 1 ;
650
- const char * type_spec = "|s!s!s!s!l!s!" ;
655
+ const char * type_spec = "|s!s!s!s!l!s!" ;
651
656
if (FAILURE
652
657
== zend_parse_parameters_ex (
653
658
ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS () TSRMLS_CC , type_spec , & host ,
654
659
& host_len , & username , & username_len , & password , & password_len ,
655
- & database , & database_len , & port , & port_is_null , & socket , & socket_len )) {
660
+ & database , & database_len , & port , & port_is_null , & socket ,
661
+ & socket_len )) {
656
662
nr_wrapper -> oldhandler (INTERNAL_FUNCTION_PARAM_PASSTHRU );
657
663
return ;
658
664
}
659
665
#else
660
- const char * type_spec = "|ssssls" ;
666
+ const char * type_spec = "|ssssls" ;
661
667
if (FAILURE
662
668
== zend_parse_parameters_ex (
663
669
ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS () TSRMLS_CC , type_spec , & host ,
@@ -811,11 +817,11 @@ NR_INNER_WRAPPER(mysqli_commit) {
811
817
nr_string_len_t name_len = 0 ;
812
818
813
819
#if ZEND_MODULE_API_NO >= ZEND_8_1_X_API_NO
814
- const char * proc_type_spec = "o|ls!" ;
815
- const char * oo_type_spec = "|ls!" ;
820
+ const char * proc_type_spec = "o|ls!" ;
821
+ const char * oo_type_spec = "|ls!" ;
816
822
#else
817
- const char * proc_type_spec = "o|ls" ;
818
- const char * oo_type_spec = "|ls" ;
823
+ const char * proc_type_spec = "o|ls" ;
824
+ const char * oo_type_spec = "|ls" ;
819
825
#endif
820
826
821
827
if (FAILURE
@@ -824,8 +830,8 @@ NR_INNER_WRAPPER(mysqli_commit) {
824
830
& mysqli_obj , & flags , & name , & name_len )) {
825
831
if (FAILURE
826
832
== zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET ,
827
- ZEND_NUM_ARGS () TSRMLS_CC , oo_type_spec , & flags ,
828
- & name , & name_len )) {
833
+ ZEND_NUM_ARGS () TSRMLS_CC , oo_type_spec ,
834
+ & flags , & name , & name_len )) {
829
835
nr_wrapper -> oldhandler (INTERNAL_FUNCTION_PARAM_PASSTHRU );
830
836
return ;
831
837
} else {
@@ -883,29 +889,29 @@ NR_INNER_WRAPPER(mysqli_real_connect) {
883
889
*/
884
890
#if ZEND_MODULE_API_NO >= ZEND_8_1_X_API_NO
885
891
bool port_is_null = 1 ;
886
- const char * proc_type_spec = "o|s!s!s!s!l!s!l" ;
887
- const char * oo_type_spec = "|s!s!s!s!l!s!l" ;
892
+ const char * proc_type_spec = "o|s!s!s!s!l!s!l" ;
893
+ const char * oo_type_spec = "|s!s!s!s!l!s!l" ;
888
894
if (FAILURE
889
895
== zend_parse_parameters_ex (
890
896
ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS () TSRMLS_CC , proc_type_spec ,
891
897
& mysqli_obj , & host , & host_len , & username , & username_len , & password ,
892
- & password_len , & database , & database_len , & port , & port_is_null , & socket , & socket_len ,
893
- & flags )) {
898
+ & password_len , & database , & database_len , & port , & port_is_null ,
899
+ & socket , & socket_len , & flags )) {
894
900
if (FAILURE
895
901
== zend_parse_parameters_ex (
896
902
ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS () TSRMLS_CC , oo_type_spec ,
897
903
& host , & host_len , & username , & username_len , & password ,
898
- & password_len , & database , & database_len , & port , & port_is_null , & socket ,
899
- & socket_len , & flags )) {
904
+ & password_len , & database , & database_len , & port , & port_is_null ,
905
+ & socket , & socket_len , & flags )) {
900
906
nr_wrapper -> oldhandler (INTERNAL_FUNCTION_PARAM_PASSTHRU );
901
907
return ;
902
908
} else {
903
909
mysqli_obj = NR_PHP_INTERNAL_FN_THIS ();
904
910
}
905
911
}
906
912
#else
907
- const char * proc_type_spec = "o|sssslsl" ;
908
- const char * oo_type_spec = "|sssslsl" ;
913
+ const char * proc_type_spec = "o|sssslsl" ;
914
+ const char * oo_type_spec = "|sssslsl" ;
909
915
if (FAILURE
910
916
== zend_parse_parameters_ex (
911
917
ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS () TSRMLS_CC , proc_type_spec ,
@@ -1411,14 +1417,14 @@ NR_INNER_WRAPPER(mysqli_stmt_construct) {
1411
1417
nr_string_len_t sqlstrlen = 0 ;
1412
1418
1413
1419
#if ZEND_MODULE_API_NO >= ZEND_8_1_X_API_NO
1414
- const char * type_spec = "o|s!" ;
1420
+ const char * type_spec = "o|s!" ;
1415
1421
#else
1416
- const char * type_spec = "o|s" ;
1422
+ const char * type_spec = "o|s" ;
1417
1423
#endif
1418
1424
if (FAILURE
1419
1425
== zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET ,
1420
- ZEND_NUM_ARGS () TSRMLS_CC , type_spec , & mysqli_obj ,
1421
- & sqlstr , & sqlstrlen )) {
1426
+ ZEND_NUM_ARGS () TSRMLS_CC , type_spec ,
1427
+ & mysqli_obj , & sqlstr , & sqlstrlen )) {
1422
1428
nr_wrapper -> oldhandler (INTERNAL_FUNCTION_PARAM_PASSTHRU );
1423
1429
return ;
1424
1430
}
@@ -1541,10 +1547,9 @@ NR_INNER_WRAPPER(memcached_add_server) {
1541
1547
int zcaught = 0 ;
1542
1548
1543
1549
if (SUCCESS
1544
- == zend_parse_parameters_ex (
1545
- ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "s|ll" , & host ,
1546
- & host_len , & port , & weight ) &&
1547
- NULL != host ) {
1550
+ == zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (),
1551
+ "s|ll" , & host , & host_len , & port , & weight )
1552
+ && NULL != host ) {
1548
1553
nr_php_memcached_create_instance_metric (host , port );
1549
1554
}
1550
1555
zcaught = nr_zend_call_old_handler (nr_wrapper -> oldhandler ,
@@ -1561,15 +1566,16 @@ NR_INNER_WRAPPER(memcached_add_servers) {
1561
1566
int zcaught = 0 ;
1562
1567
1563
1568
if (SUCCESS
1564
- == zend_parse_parameters_ex (
1565
- ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "a" , & servers )) {
1569
+ == zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "a" ,
1570
+ & servers )) {
1566
1571
if (NULL != servers && Z_TYPE_P (servers ) == IS_ARRAY ) {
1567
1572
ZEND_HASH_FOREACH_VAL (Z_ARRVAL_P (servers ), server ) {
1568
1573
zval * host = nr_php_zend_hash_index_find (Z_ARRVAL_P (server ), 0 );
1569
1574
zval * port = nr_php_zend_hash_index_find (Z_ARRVAL_P (server ), 1 );
1570
- if (nr_php_is_zval_valid_string (host ) &&
1571
- nr_php_is_zval_valid_integer (port )) {
1572
- nr_php_memcached_create_instance_metric (Z_STRVAL_P (host ), Z_LVAL_P (port ));
1575
+ if (nr_php_is_zval_valid_string (host )
1576
+ && nr_php_is_zval_valid_integer (port )) {
1577
+ nr_php_memcached_create_instance_metric (Z_STRVAL_P (host ),
1578
+ Z_LVAL_P (port ));
1573
1579
}
1574
1580
}
1575
1581
ZEND_HASH_FOREACH_END ();
@@ -3020,19 +3026,26 @@ static inline int nr_php_should_instrument_exception_handler(
3020
3026
*/
3021
3027
NR_INNER_WRAPPER (exception_common ) {
3022
3028
zval * exception_handler = NULL ;
3029
+ nrl_warning (NRL_ERROR ,
3030
+ "exception_common: attempting to restore NR exception handler" );
3023
3031
3024
3032
#if ZEND_MODULE_API_NO >= ZEND_7_0_X_API_NO /* PHP 7.0+ */
3025
3033
exception_handler = & EG (user_exception_handler );
3026
3034
#else
3027
3035
exception_handler = EG (user_exception_handler );
3028
3036
#endif
3037
+ nrl_warning (NRL_ERROR , "exception_common: old handler: %s" ,
3038
+ Z_STRVAL_P (exception_handler ));
3029
3039
3030
3040
/*
3031
3041
* Remove instrumentation from the current exception handler, if any.
3032
3042
*/
3033
3043
if (nr_php_should_instrument_exception_handler (exception_handler TSRMLS_CC )) {
3034
3044
zend_function * func ;
3035
3045
3046
+ nrl_warning (NRL_ERROR ,
3047
+ "exception_common: should instrument exception handler" );
3048
+
3036
3049
func = nr_php_zval_to_function (exception_handler TSRMLS_CC );
3037
3050
nr_php_remove_exception_function (func TSRMLS_CC );
3038
3051
}
@@ -3048,12 +3061,17 @@ NR_INNER_WRAPPER(exception_common) {
3048
3061
#else
3049
3062
exception_handler = EG (user_exception_handler );
3050
3063
#endif
3064
+ nrl_warning (NRL_ERROR , "exception_common: new handler?: %s" ,
3065
+ Z_STRVAL_P (exception_handler ));
3051
3066
3052
3067
/*
3053
3068
* Add instrumentation to the new exception handler, if any.
3054
3069
*/
3055
3070
if (nr_php_should_instrument_exception_handler (exception_handler TSRMLS_CC )) {
3056
3071
zend_function * func ;
3072
+ nrl_warning (
3073
+ NRL_ERROR ,
3074
+ "exception_common: should instrument exception handler(again?)" );
3057
3075
3058
3076
func = nr_php_zval_to_function (exception_handler TSRMLS_CC );
3059
3077
nr_php_add_exception_function (func TSRMLS_CC );
@@ -3062,6 +3080,7 @@ NR_INNER_WRAPPER(exception_common) {
3062
3080
#else
3063
3081
} else if (NULL == exception_handler ) {
3064
3082
#endif /* PHP7+ */
3083
+ nrl_warning (NRL_ERROR , "exception_common: installing nr exception handler" );
3065
3084
nr_php_error_install_exception_handler (TSRMLS_C );
3066
3085
}
3067
3086
}
@@ -3758,7 +3777,7 @@ void nr_php_generate_internal_wrap_records(void) {
3758
3777
NR_INTERNAL_WRAPREC ("redis::xclaim" , redis_xclaim , redis_function , 0 ,
3759
3778
"xclaim" )
3760
3779
NR_INTERNAL_WRAPREC ("redis::xdel" , redis_xdel , redis_function , 0 , "xdel" )
3761
- NR_INTERNAL_WRAPREC ("redis::xgroup" , redis_xgroup , redis_function , 0 ,
3780
+ NR_INTERNAL_WRAPREC ("redis::xgroup" , redis_xgroup , redis_function , 0 ,
3762
3781
"xgroup" )
3763
3782
NR_INTERNAL_WRAPREC ("redis::xinfo" , redis_xinfo , redis_function , 0 , "xinfo" )
3764
3783
NR_INTERNAL_WRAPREC ("redis::xlen" , redis_xlen , redis_function , 0 , "xlen" )
@@ -3808,7 +3827,7 @@ void nr_php_generate_internal_wrap_records(void) {
3808
3827
redis_function , 0 , "zrevrangebyscore" )
3809
3828
NR_INTERNAL_WRAPREC ("redis::zrevrank" , redis_zrevrank , redis_function , 0 ,
3810
3829
"zrevrank" )
3811
- NR_INTERNAL_WRAPREC ("redis::zscore" , redis_zscore , redis_function , 0 ,
3830
+ NR_INTERNAL_WRAPREC ("redis::zscore" , redis_zscore , redis_function , 0 ,
3812
3831
"zscore" )
3813
3832
NR_INTERNAL_WRAPREC ("redis::zunionstore" , redis_zunionstore , redis_function ,
3814
3833
0 , "zunionstore" )
0 commit comments