Skip to content

Commit

Permalink
set escape string explicitely for fgetcsv() and fputcsv() as dependin…
Browse files Browse the repository at this point in the history
…g on the default value of escape is deprecated as of PHP 8.4
  • Loading branch information
mjaschen committed Nov 26, 2024
1 parent 245b90c commit a906b85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Csv/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function ($fileHandle) use ($line): void {
$fileHandle,
$this->insertSpecialPlaceholder($line),
FormatInterface::DELIMITER,
FormatInterface::ENCLOSURE
FormatInterface::ENCLOSURE,
'',
);
}
);
Expand All @@ -50,7 +51,8 @@ function ($fileHandle) use ($lines): void {
$fileHandle,
$this->insertSpecialPlaceholder($line),
FormatInterface::DELIMITER,
FormatInterface::ENCLOSURE
FormatInterface::ENCLOSURE,
'',
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Csv/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function parse(string $csv): array

$data = [];

while ($csvLine = fgetcsv($tmpHandle, 0, FormatInterface::DELIMITER, FormatInterface::ENCLOSURE)) {
while ($csvLine = fgetcsv($tmpHandle, 0, FormatInterface::DELIMITER, FormatInterface::ENCLOSURE, '')) {
$data[] = array_map(
static function ($item) {
if (!is_string($item)) {
Expand Down

0 comments on commit a906b85

Please sign in to comment.