From 6bf5465f6734ec69dbff9e1c05fbab34147fa343 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Sun, 19 Jun 2016 12:50:15 +0000 Subject: [PATCH] Menus: Fix `_wp_expand_nav_menu_post_data()` for PHP 5.2. [37748] introduced `_wp_expand_nav_menu_post_data()` together with an `array_replace_recursive()` compatibility function for PHP 5.2. Even though that compat function is tried and tested in other projects like BuddyPress, we need to add additional `isset()` checks in order to avoid 'Undefined index' notices in our case. See #36590. git-svn-id: https://develop.svn.wordpress.org/trunk@37750 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/compat.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php index ad49ba3a0b..407e1779db 100644 --- a/src/wp-includes/compat.php +++ b/src/wp-includes/compat.php @@ -471,7 +471,10 @@ if ( ! function_exists( 'array_replace_recursive' ) ) : unset( $bref_stack[ key( $bref_stack ) ] ); foreach ( array_keys( $head ) as $key ) { - if ( isset( $key, $bref ) && is_array( $bref[ $key ] ) && is_array( $head[ $key ] ) ) { + if ( isset( $key, $bref ) && + isset( $bref[ $key ] ) && is_array( $bref[ $key ] ) && + isset( $head[ $key ] ) && is_array( $head[ $key ] ) + ) { $bref_stack[] = &$bref[ $key ]; $head_stack[] = $head[ $key ]; } else {