From 5aa65dfc4f11dd962aa1de9d04820a3b68e9a957 Mon Sep 17 00:00:00 2001 From: Roman Anasal Date: Sun, 21 Aug 2022 15:36:37 +0200 Subject: [PATCH] Fix parsing of XML messages containing instances of anonymous classes fixes #336 The generated class names of anonymous classes contain a null byte which is encoded into XML by xdebug. But since null bytes are illegal entities in XML this breaks parsing of those messages. --- lib/engines/dbgp/dbgp-instance.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/engines/dbgp/dbgp-instance.js b/lib/engines/dbgp/dbgp-instance.js index e472497..76462fd 100644 --- a/lib/engines/dbgp/dbgp-instance.js +++ b/lib/engines/dbgp/dbgp-instance.js @@ -226,6 +226,11 @@ export default class DbgpInstance { } parseXml(message) { + // strip illegal null bytes in anonymous class names + // so xml can be parsed correctly + // see https://github.com/gwomacks/php-debug/issues/336 + message = message.replace(/@anonymous�/g, '@anonymous#') + let o = parseString(message, (err, result) => { if (err) { console.error(err)