Skip to content

Commit f47c079

Browse files
authored
Fix PHP 8.4+ deprecation warning for str_getcsv() (#2622)
1 parent c32d226 commit f47c079

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

includes/class-blocklist-subscriptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static function parse_csv_string( $content ) {
169169
}
170170

171171
// Parse first line to detect format.
172-
$first_line = \str_getcsv( $lines[0] );
172+
$first_line = \str_getcsv( $lines[0], ',', '"', '\\' );
173173
$first_cell = \trim( $first_line[0] ?? '' );
174174
$has_header = \str_starts_with( $first_cell, '#' ) || 'domain' === \strtolower( $first_cell );
175175

@@ -189,7 +189,7 @@ public static function parse_csv_string( $content ) {
189189

190190
// Process each line.
191191
foreach ( $lines as $line ) {
192-
$row = \str_getcsv( $line );
192+
$row = \str_getcsv( $line, ',', '"', '\\' );
193193
$domain = \trim( $row[ $domain_index ] ?? '' );
194194

195195
// Skip empty lines and comments.

0 commit comments

Comments
 (0)