Make WordPress Core

Changeset 60741


Ignore:
Timestamp:
09/15/2025 12:57:22 PM (8 weeks ago)
Author:
swissspidy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/interactivity-api/class-wp-interactivity-api.php

    r60416 r60741  
    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 ) {
Note: See TracChangeset for help on using the changeset viewer.