Skip to content

Commit 4d0212d

Browse files
committed
fix potential fatal error on Interactivity API processing directives when wrong HTML tags
1 parent 6c21850 commit 4d0212d

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
@@ -439,7 +439,12 @@ private function _process_directives( string $html ) {
439439
array_pop( $tag_stack );
440440
}
441441
} else {
442-
if ( 0 !== count( $p->get_attribute_names_with_prefix( 'data-wp-each-child' ) ) ) {
442+
$each_child_attrs = $p->get_attribute_names_with_prefix( 'data-wp-each-child' );
443+
if ( ! is_countable( $each_child_attrs ) ) {
444+
continue;
445+
}
446+
447+
if ( 0 !== count( $each_child_attrs ) ) {
443448
/*
444449
* If the tag has a `data-wp-each-child` directive, jump to its closer
445450
* tag because those tags have already been processed.

0 commit comments

Comments
 (0)