-
-
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
Fix usage of non empty $escape
in PHP 8.4
#531
Fix usage of non empty $escape
in PHP 8.4
#531
Conversation
@cedric-anne thanks for the submission but I think it is unfortunate that this RFC seems to have passed. As there is no clear workaround or patches for that. The fix you are proposing CAN/SHOULD be considered as a BC breaking change for the whole package. But also for anyone using the csv related functions/methods of PHP. To put it bluntly, the only way to avoid triggering the deprecation warning one will have be to explicitly set the escape parameter to the empty string basically which is NOT the default in PHP 🤷🏾 Changing the default escape sequence register in my book as being a BC break. This is one of the rare occurence IMHO were a hard BC between PHP8 -> PHP9 would have been better because there is no clear sensible way of fixing that. |
@cedric-anne the enclosure parameter is unaffected by the deprecation warning so I do not think it should be changed at all. |
@@ -44,8 +44,8 @@ abstract class AbstractCsv implements ByteSequence | |||
protected ?Bom $input_bom = null; | |||
protected ?Bom $output_bom = null; | |||
protected string $delimiter = ','; | |||
protected string $enclosure = '"'; | |||
protected string $escape = '\\'; | |||
protected string $enclosure = '\\'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is not required and not needed.
protected string $enclosure = '"'; | ||
protected string $escape = '\\'; | ||
protected string $enclosure = '\\'; | ||
protected string $escape = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a BC break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the change to the enclosure property. For the escape property I am on the fence about changing a default parameter as this introduce a BC break.
@cedric-anne I will close this PR and redirect you to the issue I just opened which summarizes the problem and what I see for now as potential solutions. |
Using a non empty string for
$escape
to is deprecated in PHP 8.4, see php/php-src#15365As far as I understand, using
\\
for$enclosure
and `` for$escape
will result in the same, according to https://www.php.net/manual/fr/function.fgetcsv.php