Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.

PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.




git-svn-id: https://develop.svn.wordpress.org/trunk@45639 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2019-07-15 06:24:08 +00:00
parent e6c750b55c
commit 2da7f9f524
9 changed files with 32 additions and 20 deletions
+5 -1
View File
@@ -523,7 +523,11 @@ function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false )
if ( ! $meta_cache ) {
$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
$meta_cache = $meta_cache[ $object_id ];
if ( isset( $meta_cache[ $object_id ] ) ) {
$meta_cache = $meta_cache[ $object_id ];
} else {
$meta_cache = null;
}
}
if ( ! $meta_key ) {