diff --git a/ext/compatibility.h b/ext/compatibility.h index 6ed5229a53..f85d747ea3 100644 --- a/ext/compatibility.h +++ b/ext/compatibility.h @@ -620,7 +620,11 @@ static zend_always_inline zend_result zend_call_function_with_return_value(zend_ #undef ZEND_RAW_FENTRY #define ZEND_RAW_FENTRY(zend_name, name, arg_info, flags, ...) { zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags }, +#if PHP_VERSION_ID < 70100 +#define hasThis() (Z_OBJ_P(ZEND_THIS) != NULL) +#else #define hasThis() (Z_TYPE_P(ZEND_THIS) == IS_OBJECT) #endif +#endif #endif // DD_COMPATIBILITY_H diff --git a/ext/live_debugger.c b/ext/live_debugger.c index 211be6513c..2b1b9335e1 100644 --- a/ext/live_debugger.c +++ b/ext/live_debugger.c @@ -409,7 +409,7 @@ static void dd_log_probe_capture_snapshot(ddog_DebuggerCapture *capture, dd_log_ } if (hasThis()) { struct ddog_CaptureValue capture_value = {0}; - ddtrace_create_capture_value(&EX(This), &capture_value, capture_config, capture_config->max_reference_depth); + ddtrace_create_capture_value(getThis(), &capture_value, capture_config, capture_config->max_reference_depth); ddog_snapshot_add_field(capture, DDOG_FIELD_TYPE_ARG, DDOG_CHARSLICE_C("this"), capture_value); } } @@ -441,7 +441,7 @@ static void dd_log_probe_end(zend_ulong invocation, zend_execute_data *execute_d dd_log_probe_capture_snapshot(capture, def, execute_data); const ddog_CaptureConfiguration *capture_config = def->parent.probe.probe.log.capture; struct ddog_CaptureValue capture_value = {0}; - ddtrace_create_capture_value(&EX(This), &capture_value, capture_config, capture_config->max_reference_depth); + ddtrace_create_capture_value(retval, &capture_value, capture_config, capture_config->max_reference_depth); ddog_snapshot_add_field(capture, DDOG_FIELD_TYPE_ARG, DDOG_CHARSLICE_C("@return"), capture_value); } ddtrace_sidecar_send_debugger_datum(dyn->payload); diff --git a/tests/ext/live-debugger/debugger_log_probe.phpt b/tests/ext/live-debugger/debugger_log_probe.phpt index 05385932bd..e786629ba0 100644 --- a/tests/ext/live-debugger/debugger_log_probe.phpt +++ b/tests/ext/live-debugger/debugger_log_probe.phpt @@ -138,32 +138,9 @@ array(5) { ["@return"]=> array(2) { ["type"]=> - string(3) "Bar" - ["fields"]=> - array(1) { - ["prop"]=> - array(2) { - ["type"]=> - string(5) "array" - ["elements"]=> - array(2) { - [0]=> - array(2) { - ["type"]=> - string(3) "int" - ["value"]=> - string(1) "1" - } - [1]=> - array(2) { - ["type"]=> - string(3) "int" - ["value"]=> - string(1) "2" - } - } - } - } + string(3) "int" + ["value"]=> + string(2) "30" } ["arg1"]=> array(2) {