From c3514e96e892431c18466f3be6a6a713c8a0514d Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Wed, 22 Apr 2026 15:38:49 +0200 Subject: [PATCH] Fix instanceof type aliases for PHP 7.x in live debugger DSL PHP 7.x returns "integer" for IS_LONG and "double" for IS_DOUBLE from zend_zval_type_name(), while the debugger DSL uses "int" and "float". Add alias normalization so instanceof checks work across PHP versions. --- ext/live_debugger.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ext/live_debugger.c b/ext/live_debugger.c index e758ce0cf20..39940ee2acd 100644 --- a/ext/live_debugger.c +++ b/ext/live_debugger.c @@ -1591,7 +1591,19 @@ static bool dd_eval_instanceof(void *ctx, const void *zvp, const ddog_CharSlice { name = zend_zval_type_name(zv); } - return zend_binary_strcasecmp(name, strlen(name), class->ptr, class->len) == 0; + if (zend_binary_strcasecmp(name, strlen(name), class->ptr, class->len) == 0) { + return true; + } + // PHP 7.x returns "integer"/"double"; normalize aliases for DSL compatibility + if (Z_TYPE_P(zv) == IS_LONG) { + return zend_binary_strcasecmp(ZEND_STRL("int"), class->ptr, class->len) == 0 + || zend_binary_strcasecmp(ZEND_STRL("integer"), class->ptr, class->len) == 0; + } + if (Z_TYPE_P(zv) == IS_DOUBLE) { + return zend_binary_strcasecmp(ZEND_STRL("float"), class->ptr, class->len) == 0 + || zend_binary_strcasecmp(ZEND_STRL("double"), class->ptr, class->len) == 0; + } + return false; } const ddog_Evaluator dd_evaluator = {