fputcsv() Needs Escape Parameter
fputcsv() used to have the $escape parameter with a default value. This is not the case anymore in PHP 8.4, where it is necessary to provide its value.
PHP code
<?php
$fp = fopen(':memory:', 'w');
var_dump(fputcsv($fp, [1,2,3]));
?>
Before
int(6)
After
PHP Deprecated: fputcsv(): the $escape parameter must be provided as its default value will chang
Deprecated: fputcsv(): the $escape parameter must be provided as its default value will change
int(6)
PHP version change
This behavior was deprecated in 8.4.
This behavior changed in 8.4.
See Also
- PHP RFC: Kill proprietary CSV escaping mechanism
- PHP 8.4: CSV: The $escape parameter must be provided