Skip to content

Commit aedb36e

Browse files
hugosolarsamueljseay
authored andcommitted
fix potential fatal error on Interactivity API processing directives when wrong HTML tags
(cherry picked from commit 4d0212d)
1 parent 98b12d1 commit aedb36e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/wp-includes/interactivity-api/class-wp-interactivity-api.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,12 @@ private function _process_directives( string $html ) {
520520
array_pop( $tag_stack );
521521
}
522522
} else {
523-
if ( 0 !== count( $p->get_attribute_names_with_prefix( 'data-wp-each-child' ) ) ) {
523+
$each_child_attrs = $p->get_attribute_names_with_prefix( 'data-wp-each-child' );
524+
if ( ! is_countable( $each_child_attrs ) ) {
525+
continue;
526+
}
527+
528+
if ( 0 !== count( $each_child_attrs ) ) {
524529
/*
525530
* If the tag has a `data-wp-each-child` directive, jump to its closer
526531
* tag because those tags have already been processed.

0 commit comments

Comments
 (0)