Make WordPress Core


Ignore:
Timestamp:
06/04/2024 06:56:25 AM (2 years ago)
Author:
gziolo
Message:

Interactivity API: Some property access does not work well in server directives

Ensures property access in PHP works for object properties or associative array values correctly when processing Interactivity API directives.

Props narenin, cbravobernal, jonsurrell, gziolo, czapla.
Fixes #61039.

File:
1 edited

Legend:

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

    r58159 r58320  
    424424                $current       = $store;
    425425                foreach ( $path_segments as $path_segment ) {
    426                         if ( isset( $current[ $path_segment ] ) ) {
     426                        if ( ( is_array( $current ) || $current instanceof ArrayAccess ) && isset( $current[ $path_segment ] ) ) {
    427427                                $current = $current[ $path_segment ];
     428                        } elseif ( is_object( $current ) && isset( $current->$path_segment ) ) {
     429                                $current = $current->$path_segment;
    428430                        } else {
    429431                                return null;
Note: See TracChangeset for help on using the changeset viewer.