Coding Standards: Use strict type check for in_array() and array_search().
This addresses all the remaining `WordPress.PHP.StrictInArray.MissingTrueStrict` issues in core. Includes minor code layout fixes for better readability. Follow-up to [47550]. See #49542. Built from https://develop.svn.wordpress.org/trunk@47557 git-svn-id: http://core.svn.wordpress.org/trunk@47332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -2170,7 +2170,7 @@ function add_option_whitelist( $new_options, $options = '' ) {
|
||||
$whitelist_options[ $page ] = array();
|
||||
$whitelist_options[ $page ][] = $key;
|
||||
} else {
|
||||
$pos = array_search( $key, $whitelist_options[ $page ] );
|
||||
$pos = array_search( $key, $whitelist_options[ $page ], true );
|
||||
if ( false === $pos ) {
|
||||
$whitelist_options[ $page ][] = $key;
|
||||
}
|
||||
@@ -2202,7 +2202,7 @@ function remove_option_whitelist( $del_options, $options = '' ) {
|
||||
foreach ( $del_options as $page => $keys ) {
|
||||
foreach ( $keys as $key ) {
|
||||
if ( isset( $whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) {
|
||||
$pos = array_search( $key, $whitelist_options[ $page ] );
|
||||
$pos = array_search( $key, $whitelist_options[ $page ], true );
|
||||
if ( false !== $pos ) {
|
||||
unset( $whitelist_options[ $page ][ $pos ] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user