From 8b3072e13d2a7c2ca3f0fb6f768927dd87773e48 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 4 Nov 2024 14:53:36 +0100 Subject: [PATCH 1/2] Explicitly provide `$escape` to `str_getcsv` --- src/Context/Support.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Context/Support.php b/src/Context/Support.php index 6c9f3dd7..c3ef3691 100644 --- a/src/Context/Support.php +++ b/src/Context/Support.php @@ -172,7 +172,10 @@ protected function check_that_json_string_contains_json_string( $actual_json, $e * @return bool Whether $actual_csv contains $expected_csv */ protected function check_that_csv_string_contains_values( $actual_csv, $expected_csv ) { - $actual_csv = array_map( 'str_getcsv', explode( PHP_EOL, $actual_csv ) ); + $actual_csv = array_map( + static function ( $str ) { + return str_getcsv( $str, ',', '"', "\\" ); + }, explode( PHP_EOL, $actual_csv ) ); if ( empty( $actual_csv ) ) { return false; From 6a76a0cfbb072ee19dd8aad57d7b2bcd50d686f7 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 4 Nov 2024 14:59:30 +0100 Subject: [PATCH 2/2] lint fix --- src/Context/Support.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Context/Support.php b/src/Context/Support.php index c3ef3691..67a16ab4 100644 --- a/src/Context/Support.php +++ b/src/Context/Support.php @@ -174,8 +174,10 @@ protected function check_that_json_string_contains_json_string( $actual_json, $e protected function check_that_csv_string_contains_values( $actual_csv, $expected_csv ) { $actual_csv = array_map( static function ( $str ) { - return str_getcsv( $str, ',', '"', "\\" ); - }, explode( PHP_EOL, $actual_csv ) ); + return str_getcsv( $str, ',', '"', '\\' ); + }, + explode( PHP_EOL, $actual_csv ) + ); if ( empty( $actual_csv ) ) { return false;