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.



Built from https://develop.svn.wordpress.org/trunk@58320


git-svn-id: http://core.svn.wordpress.org/trunk@57777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo 2024-06-04 06:58:15 +00:00
parent 75f3babe49
commit d2a459572e
2 changed files with 4 additions and 2 deletions

View File

@ -423,8 +423,10 @@ final class WP_Interactivity_API {
$path_segments = explode( '.', $path );
$current = $store;
foreach ( $path_segments as $path_segment ) {
if ( isset( $current[ $path_segment ] ) ) {
if ( ( is_array( $current ) || $current instanceof ArrayAccess ) && isset( $current[ $path_segment ] ) ) {
$current = $current[ $path_segment ];
} elseif ( is_object( $current ) && isset( $current->$path_segment ) ) {
$current = $current->$path_segment;
} else {
return null;
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.6-alpha-58319';
$wp_version = '6.6-alpha-58320';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.