Skip to content

Commit

Permalink
Merge pull request #227 from wp-cli/fix/str_getcsv
Browse files Browse the repository at this point in the history
Explicitly provide `$escape` to `str_getcsv`
  • Loading branch information
swissspidy authored Nov 24, 2024
2 parents a8de3f0 + 6a76a0c commit 3c29e6a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Context/Support.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ 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;
Expand Down

0 comments on commit 3c29e6a

Please sign in to comment.