From ba2b4127ec91e89711d6b6e1dd6c9c968836329b Mon Sep 17 00:00:00 2001 From: Kamran Abdul Aziz Date: Wed, 3 Jun 2026 12:29:40 +0530 Subject: [PATCH 1/2] Fix empty STDIN handling for user import-csv --- features/user-import-csv.feature | 1 - src/User_Command.php | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/features/user-import-csv.feature b/features/user-import-csv.feature index a0098e6f3..802ffb92e 100644 --- a/features/user-import-csv.feature +++ b/features/user-import-csv.feature @@ -140,7 +140,6 @@ Feature: Import users from CSV | Bob Jones | contributor | | Bill Jones | administrator,author | - @broken Scenario: Importing users from STDIN Given a WP install And a users.csv file: diff --git a/src/User_Command.php b/src/User_Command.php index 461d6bd4b..d1c7d1c93 100644 --- a/src/User_Command.php +++ b/src/User_Command.php @@ -1150,6 +1150,10 @@ public function import_csv( $args, $assoc_args ) { $csv_data[] = $data; } + + if ( empty( $indexes ) || empty( $csv_data ) ) { + WP_CLI::error( 'Unable to read content from STDIN.' ); + } } else { $csv_data = new CsvIterator( $filename ); } From 15e64209c6206f58cf00ad98e542d871abd5c421 Mon Sep 17 00:00:00 2001 From: Kamran Abdul Aziz Date: Wed, 3 Jun 2026 14:59:06 +0530 Subject: [PATCH 2/2] Narrow empty STDIN validation --- src/User_Command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/User_Command.php b/src/User_Command.php index d1c7d1c93..59d6f3d34 100644 --- a/src/User_Command.php +++ b/src/User_Command.php @@ -1151,7 +1151,7 @@ public function import_csv( $args, $assoc_args ) { $csv_data[] = $data; } - if ( empty( $indexes ) || empty( $csv_data ) ) { + if ( empty( $indexes ) && empty( $csv_data ) ) { WP_CLI::error( 'Unable to read content from STDIN.' ); } } else {