Syntax error with double quotes
Closed this issue · 3 comments
thekid commented
The following produces a syntax error:
$ xp -w '"Hello World"'
Exception lang.Error (
Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE)
or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in
D:\...\tools\src\main\php\xp\runtime\Dump.class.php(51) : eval()'d code on line 1
thekid commented
The command line arguments passed to xp.exe
are -w
and "Hello World"
, the error occurs during escaping them before forking the PHP runtime, which is passed the following: ... xp.runtime.Dump "-w" """"Hello World""""
, which in turns comes out as [ '-w', '"Hello', 'World"' ]
inside PHP.
thekid commented
Test suite:
Double quotes
$ xp -w '"Hello"'
Hello
$ xp -w '"Hello World"'
Hello World
$ xp -w '"Hello \" World"'
Hello " World
$ xp -w '"Hello \"the\" World"'
Hello "the" World
$ xp -w '"Hello World\n"'
Hello World
Single quotes
$ xp -w "'Hello'"
Hello
$ xp -w "'Hello World'"
Hello World
$ xp -w "'Hello \' World'"
Hello ' World
x xp -w "'Hello \'the\' World'"
Hello 'the' World
$ xp -w "'Hello World\n'"
Hello World\n`
thekid commented
Released - results after running xprt-update.bat
now:
$ xp -w '"Hello World"'
Hello World
🆗