Skip to content

Commit 564eb69

Browse files
committed
Interactivity API: Fix "Cannot use bool as array" error.
Improves PHP 8.5 compatibility where calling `list()` on an empty array throws a warning. Props swissspidy, jonsurrell, mukesh27. Fixes #63977. See #63061. git-svn-id: https://develop.svn.wordpress.org/trunk@60741 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f506f28 commit 564eb69

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private function _process_directives( string $html ) {
423423
}
424424

425425
if ( $p->is_tag_closer() ) {
426-
list( $opening_tag_name, $directives_prefixes ) = end( $tag_stack );
426+
list( $opening_tag_name, $directives_prefixes ) = ! empty( $tag_stack ) ? end( $tag_stack ) : array( null, null );
427427

428428
if ( 0 === count( $tag_stack ) || $opening_tag_name !== $tag_name ) {
429429

0 commit comments

Comments
 (0)