Changeset 55851 for trunk/src/wp-includes/functions.php
- Timestamp:
- 05/23/2023 09:58:56 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r55703 r55851 4948 4948 4949 4949 foreach ( $path as $path_element ) { 4950 if ( 4951 ! is_array( $input_array ) || 4952 ( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) || 4953 ! array_key_exists( $path_element, $input_array ) 4950 if ( ! is_array( $input_array ) ) { 4951 return $default_value; 4952 } 4953 4954 if ( is_string( $path_element ) 4955 || is_integer( $path_element ) 4956 || null === $path_element 4954 4957 ) { 4955 return $default_value; 4956 } 4957 $input_array = $input_array[ $path_element ]; 4958 /* 4959 * Check if the path element exists in the input array. 4960 * We check with `isset()` first, as it is a lot faster 4961 * than `array_key_exists()`. 4962 */ 4963 if ( isset( $input_array[ $path_element ] ) ) { 4964 $input_array = $input_array[ $path_element ]; 4965 continue; 4966 } 4967 4968 /* 4969 * If `isset()` returns false, we check with `array_key_exists()`, 4970 * which also checks for `null` values. 4971 */ 4972 if ( array_key_exists( $path_element, $input_array ) ) { 4973 $input_array = $input_array[ $path_element ]; 4974 continue; 4975 } 4976 } 4977 4978 return $default_value; 4958 4979 } 4959 4980
Note: See TracChangeset
for help on using the changeset viewer.