-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
Handling escape parameter in PHP8.4+ #532
Comments
@cedric-anne I am leaning into doing nothing regarding the default value and the PHP8.4 deprecation notice. I will try to write a lengthy blog post explaining the why of my decision> TL;DR: it is best for DX usage to not try to outsmart PHP expectations in the particular case. |
I figured out that, in the application I maintain, the double quotes are replaced by two single quotes prior to the CSV operations. The result is that the escaping char is never used, so I just set it to an empty string and the deprecation notice dissapeared without any functional impact. That said, I do not know how it should be handled in the |
@cedric-anne indeed that's also my conclusion BC Break in the next major regarding the default value for the escape parameter is the only sustainable solution. Everything else would result in more headache for the developer using the library. |
After much consideration I decided to do nothing about this issue. https://nyamsprod.com/blog/csv-and-php8-4/ TL;DR:
I prefer communicating than releasing. a solution that works less hat 50% of the time. |
In PHP8.4 the escape parameter is deprecated to use with csv methods and functions in PHP.
This means for league/csv that
An easy workaround would be to tell users via documentation and communication that they now need to do the following:
But since the end goal it to remove the escape character mechanism completely this means that
setEscape
andgetEscape
should also be deprecated which leads to a chicken and a egg issue. If you are on version 9 to fix the issue in 8.4 you need to add a method call which will be removed once you are on version 10 with PHP8.4 or PHP9. Which adds burden to migration.Another way to deal with this issue would be to release a new major version of league/csv with the escape mechanism removed entirely and internally always using the empty string. This is possible for every supported version of PHP. But releasing a new major version only for this is cumbersome as they are other major area of the package that would benefit for a clean up and an upgrade and the time constraint before the release of PHP8.4 is limiting the time to refactor correctly the package in a state that would be satisfying from maintenance POV.
Of course we could think of other strategies or solutions if you have one, you are welcomed to submit them in the comment
The text was updated successfully, but these errors were encountered: