From 3b9bfa1383eb48e85dde3e037ca7140bbcd8a45a Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Mon, 28 Nov 2022 11:51:33 -0500 Subject: [PATCH] avoid scan errors --- ext/afform/core/Civi/Afform/Symbols.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ext/afform/core/Civi/Afform/Symbols.php b/ext/afform/core/Civi/Afform/Symbols.php index 5033d73bc5..73fa4fb6bb 100644 --- a/ext/afform/core/Civi/Afform/Symbols.php +++ b/ext/afform/core/Civi/Afform/Symbols.php @@ -37,15 +37,12 @@ class Symbols { $symbols = new static(); $oldErrorStatus = libxml_use_internal_errors(TRUE); $doc = new \DOMDocumentWrapper($html, 'text/html'); - foreach (libxml_get_errors() as $error) { - if (substr($error->message, 0, 3) === 'Tag' && substr(trim($error->message), -7, 7) === 'invalid') { - // ignore? libxml treats e.g. af-field tags as invalid html - } - else { - // This is similar to when use_internal_errors is false. - trigger_error($error->message, E_USER_WARNING); - } - } + // Angular isn't fussy about technically invalid html, such as unescaped + // `>` in ng-if statements. But php/libxml is. Since this is all for + // angular, let's also be less fussy. This will mean silly typos which + // might be otherwise quickly noticed via the error will be more hidden, + // but that's the same as before, and it's not worth flooding logs with + // known issues. libxml_clear_errors(); libxml_use_internal_errors($oldErrorStatus); $symbols->scanNode($doc->root); -- 2.25.1