bobthecow / psysh

A REPL for PHP
https://psysh.org
MIT License
9.74k stars 311 forks source link

PsySH does not escape backslash and other glitches. #351

Open beyondlimits opened 7 years ago

beyondlimits commented 7 years ago

Windows 7, PHP 7.1.0, PsySH v0.8.1 Since \ character is not escaped properly, it creates ambiguity whether "\n" is a new line character or a backslash followed by a n.

>>> "\n"
=> "\n"
>>> "\\n"
=> "\n"

Other strings containing backslash also exhibit weird behavior:

>>> "\<<"
=> "<<"
>>> "\\<<"
=> "<<"
>>> "\\\<<"
=> "<<"
>>> "\\\\<<"
=> "<<"
>>> "\\\\\<<"
=> "\<<"
bobthecow commented 7 years ago

For the \\n issue, it should be using color to disambiguate. Does it show the \ and \n in different colors for you?

Some backslash issues are fixed with #359, but the ones with \< (and all sorts of variants around it) persist because that's how symphony console escapes their color tags, and IIRC they have some logic in there to prevent double escaping… I'll keep this issue around and try to make some more progress on a fix for this.

beyondlimits commented 7 years ago

For the \\n issue, it should be using color to disambiguate. Does it show the \ and \n in different colors for you?

Indeed. I just had to use better terminal than the default one delivered with Windows.