Skip to content

NonPrintableCharacterFixer - fix for when removing non-printable character break PHP syntax#6160

Merged
SpacePossum merged 1 commit intoPHP-CS-Fixer:masterfrom
werlos:fix_NonPrintableCharacterFixer
Dec 13, 2021
Merged

NonPrintableCharacterFixer - fix for when removing non-printable character break PHP syntax#6160
SpacePossum merged 1 commit intoPHP-CS-Fixer:masterfrom
werlos:fix_NonPrintableCharacterFixer

Conversation

@kubawerlos
Copy link
Member

@kubawerlos kubawerlos commented Dec 10, 2021

Apparently it is possible to use zero-width space and non-breaking space in such way that removing them (NonPrintableCharacterFixer replaces non-breaking space with normal space) breaks PHP syntax:

<?php
/* Hello *<zero-width space here>/ World! */
$foo<non-breaking space here>bar = true;

Should we use ultimate solution here and check if removing non-printable character breaks PHP syntax or have fun with tokens and comment's content (if that's even possible, I've found these 2 cases, could be more)?

@kubawerlos kubawerlos changed the title NonPrintableCharacterFixer - fix for when removing non-printable character close the multi-line comment NonPrintableCharacterFixer - fix for when removing non-printable character break PHP syntax Dec 10, 2021
@coveralls
Copy link

coveralls commented Dec 11, 2021

Coverage Status

Coverage increased (+0.002%) to 93.033% when pulling 940690d on werlos:fix_NonPrintableCharacterFixer into 56d8399 on FriendsOfPHP:master.

@kubawerlos kubawerlos marked this pull request as ready for review December 11, 2021 21:21
@SpacePossum
Copy link
Contributor

Thank you @kubawerlos.

@SpacePossum SpacePossum merged commit f2808cf into PHP-CS-Fixer:master Dec 13, 2021
@kubawerlos kubawerlos deleted the fix_NonPrintableCharacterFixer branch December 13, 2021 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments