Skip to content

Allow configuring escape for CsvWriter#10

Closed
edsrzf wants to merge 1 commit into
portphp:masterfrom
edsrzf:writer-configure-escape
Closed

Allow configuring escape for CsvWriter#10
edsrzf wants to merge 1 commit into
portphp:masterfrom
edsrzf:writer-configure-escape

Conversation

@edsrzf

@edsrzf edsrzf commented Nov 18, 2024

Copy link
Copy Markdown

PHP 8.4 deprecates calls to fputcsv that don't pass '' as the $escape argument. Without this change, it's impossible to avoid a deprecation warning when using CsvWriter.

If a new major version of this library is released, it should change the default to empty string to avoid the warning by default.

PHP 8.4 deprecates calls to `fputcsv` that don't pass `''` as the
`$escape` argument. Without this change, it's impossible to avoid a
deprecation warning when using `CsvWriter`.

If a new major version of this library is released, it should change the
default to empty string to avoid the warning by default.
@slashrsm

Copy link
Copy Markdown
Contributor

Superseded by #17 (rebased onto 3.0.0 master, with PHPUnit coverage for the escape parameter / PHP 8.4 fputcsv deprecation). Merged as e3f743d. Thanks @edsrzf!

@slashrsm slashrsm closed this Jul 23, 2026
slashrsm added a commit that referenced this pull request Jul 23, 2026
PHP 8.4 deprecates fputcsv() calls that omit the $escape argument.
Add an optional constructor parameter (default '\\' for BC) and pass it
through to fputcsv so callers can silence the deprecation and control
escape behavior (including empty string for modern "no escape" CSV).

Adds PHPUnit coverage that proves escape is applied and that writing
works without deprecation exceptions under convertDeprecationsToExceptions.

Supersedes #10.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants