Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / ezyang / htmlpurifier / library / HTMLPurifier / Injector.php
index 5060eef9e239336f09fe545204ccab1620918430..116b470c374a30224f23c659fb65f7a7e98a1ae2 100644 (file)
@@ -157,11 +157,13 @@ abstract class HTMLPurifier_Injector
             return false;
         }
         // check for exclusion
-        for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
-            $node = $this->currentNesting[$i];
-            $def  = $this->htmlDefinition->info[$node->name];
-            if (isset($def->excludes[$name])) {
-                return false;
+        if (!empty($this->currentNesting)) {
+            for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) {
+                $node = $this->currentNesting[$i];
+                $def  = $this->htmlDefinition->info[$node->name];
+                if (isset($def->excludes[$name])) {
+                    return false;
+                }
             }
         }
         return true;