Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly provide $escape to str_getcsv #227

Merged
merged 2 commits into from
Nov 24, 2024
Merged

Explicitly provide $escape to str_getcsv #227

merged 2 commits into from
Nov 24, 2024

Conversation

swissspidy
Copy link
Member

Addresses the following test failure on PHP 8.4: https://github.com/wp-cli/wp-cli/actions/runs/11656752489/job/32453448665#step:11:76

str_getcsv(): the $escape parameter must be provided as its default value will change in vendor/wp-cli/wp-cli-tests/src/Context/Support.php line 175

As per the documentation:

Warning
When escape is set to anything other than an empty string ("") it can result in CSV that is not compliant with » RFC 4180 or unable to survive a roundtrip through the PHP CSV functions. The default for escape is "\" so it is recommended to set it to the empty string explicitly. The default value will change in a future version of PHP, no earlier than PHP 9.0.

@swissspidy swissspidy added bug Something isn't working scope:testing labels Nov 4, 2024
@swissspidy swissspidy requested a review from a team as a code owner November 4, 2024 13:56
@swissspidy
Copy link
Member Author

@wp-cli/committers Would appreciate a review here to help address this PHP 8.4 compat issue.

@mrsdizzie
Copy link
Member

Looks good, one thing I noted from https://www.php.net/manual/en/function.str-getcsv.php:

Warning: When escape is set to anything other than an empty string ("") it can result in CSV that is not compliant with » RFC 4180 or unable to survive a roundtrip through the PHP CSV functions. The default for escape is "\" so it is recommended to set it to the empty string explicitly. The default value will change in a future version of PHP, no earlier than PHP 9.0.

So I suppose at some point in the future we won't have the 'default' value anymore as a result of this change which specifies all of the arguments vs using defaults. It doesn't change how it works now though.

@swissspidy swissspidy merged commit 3c29e6a into main Nov 24, 2024
41 of 43 checks passed
@swissspidy swissspidy deleted the fix/str_getcsv branch November 24, 2024 07:57
@swissspidy swissspidy added this to the 4.3.5 milestone Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scope:testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants