diff --git a/features/find.feature b/features/find.feature index eb27edd..7eb2486 100644 --- a/features/find.feature +++ b/features/find.feature @@ -173,6 +173,13 @@ Feature: Find WordPress installs on the filesystem """ @test1: path: {TEST_DIR}/subdir2 + @invalid_empty: + path: '' + @invalid_non_string: + path: + - invalid + @invalid_group: + - @test1 """ When I run `wp find {TEST_DIR} --fields=version_path,alias` diff --git a/src/Find_Command.php b/src/Find_Command.php index 2c1b6c6..674ed18 100644 --- a/src/Find_Command.php +++ b/src/Find_Command.php @@ -213,7 +213,7 @@ static function ( $path ) { $aliases = WP_CLI::get_runner()->aliases; foreach ( $aliases as $alias => $target ) { - if ( empty( $target['path'] ) ) { + if ( ! is_array( $target ) || ! isset( $target['path'] ) || ! is_string( $target['path'] ) || '' === $target['path'] ) { continue; } $this->resolved_aliases[ rtrim( Path::normalize( $target['path'] ), '/' ) ] = $alias;