ArrayHtml - Improve comments and warnings
authorTim Otten <totten@civicrm.org>
Wed, 13 Jun 2018 03:32:19 +0000 (20:32 -0700)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:16 +0000 (19:13 -0700)
ext/afform/CRM/Afform/ArrayHtml.php

index c6dd28e8c5f68a2642c8c1307ff01c68e6c40615..fa9089a66d2692c88b45b278e2c93a129857508a 100644 (file)
@@ -35,6 +35,11 @@ class CRM_Afform_ArrayHtml {
       elseif (is_array($attrValue) && $this->allowStructuredAttribute($tag, $attrName)) {
         $buf .= sprintf(' %s="%s"', $attrName, htmlentities(json_encode($attrValue))); // FIXME attribute encoding
       }
+      else {
+        Civi::log()->warning('Afform: Cannot serialize attribute {attrName}', [
+          'attrName' => $attrName,
+        ]);
+      }
     }
     $buf .= '>';
 
@@ -61,7 +66,7 @@ class CRM_Afform_ArrayHtml {
     $doc = new DOMDocument();
     $doc->loadHTML("<html><body>$html</body></html>");
 
-    // FIXME: Valid expected number of child nodes
+    // FIXME: Validate expected number of child nodes
 
     foreach ($doc->childNodes as $htmlNode) {
       if ($htmlNode instanceof DOMElement && $htmlNode->tagName === 'html') {