Commit 3b70171c7ec for woocommerce

commit 3b70171c7ec46d1738f9ce1e8cc6bd6916d5d228
Author: Darren Ethier <darren@roughsmootheng.in>
Date:   Wed Sep 2 15:02:56 2026 -0400

    Ignore array values for the report export filename (#68293)

diff --git a/plugins/woocommerce/changelog/fix-wooairr-218-report-export-filename b/plugins/woocommerce/changelog/fix-wooairr-218-report-export-filename
new file mode 100644
index 00000000000..15e1710ee70
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-wooairr-218-report-export-filename
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Ignore array values for the analytics report export filename instead of raising a PHP warning.
diff --git a/plugins/woocommerce/src/Admin/ReportExporter.php b/plugins/woocommerce/src/Admin/ReportExporter.php
index d2931de08a9..2b80668cb1f 100644
--- a/plugins/woocommerce/src/Admin/ReportExporter.php
+++ b/plugins/woocommerce/src/Admin/ReportExporter.php
@@ -179,11 +179,12 @@ class ReportExporter {
 		if (
 			isset( $_GET['action'] ) &&
 			! empty( $_GET['filename'] ) &&
-			self::DOWNLOAD_EXPORT_ACTION === wp_unslash( $_GET['action'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Read-only export download reached from an emailed admin link and gated on the view_woocommerce_reports capability; the value is only compared verbatim against a fixed action name.
+			is_string( $_GET['filename'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Download of a report file generated for the requesting user and deleted once served; gated on the view_woocommerce_reports capability, so a nonce would only prevent nuisance CSRF.
+			self::DOWNLOAD_EXPORT_ACTION === wp_unslash( $_GET['action'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Download of a report file generated for the requesting user and deleted once served; gated on the view_woocommerce_reports capability, so a nonce would only prevent nuisance CSRF. The value is only compared verbatim against a fixed action name.
 			current_user_can( 'view_woocommerce_reports' )
 		) {
 			$exporter = new ReportCSVExporter();
-			$exporter->set_filename( wp_unslash( $_GET['filename'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Read-only export download reached from an emailed admin link and gated on the view_woocommerce_reports capability; set_filename() applies sanitize_file_name(), which keeps the read inside the reports directory.
+			$exporter->set_filename( wp_unslash( $_GET['filename'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Download of a report file generated for the requesting user and deleted once served; gated on the view_woocommerce_reports capability, so a nonce would only prevent nuisance CSRF. set_filename() applies sanitize_file_name(), which keeps the path inside the reports directory.
 			$exporter->export();
 		}
 	}