Parse error on line 1 at column 0:

Hello,I’m now having problem using arcanist while typing ‘arc diff’ command.The version of mine is
the latest.When I use the ‘arc diff’ command it returns error message like the following pic.


Could u please help me?

Which version of PHP and OS are you using?

The code that’s crashing is invoking PHP, getting it to print out a JSON, and then tries to parse this JSON body - but the output isn’t proper JSON format:

    list($env) = execx(
      'php -d variables_order=E -r %s',
      'echo json_encode($_ENV);');
    $env = phutil_json_decode($env);  

https://secure.phabricator.com/diffusion/ARC/browse/master/src/utils/PhutilExecutionEnvironment.php$38

Is your php command maybe not called php?

Thank you for answering my question:)
My php version is PHP 7.2.31 (cli) (built: May 12 2020 10:26:30) ( NTS MSVC15 (Visual C++ 2017) x64 ).
And my OS is Win10 Home Edition.
Yesterday I switched the arcanist and libphutil version to legacy-2019 and commented out this part of File [\libphutil\src\future\exec\PhutilExecPassthru.php].
image
After doing these,I finally could use it to commit my changes.
I have never learned or used PHP, so I guess this problem was due to the changes of PHP for so many versions.
Thank u for your help:)

Commenting out this part could have unexpected side-effects (also using an old version of arc).

A simpler work-around is to add E to the variables_order, so that repairMissingVariablesOrder would not try to parse a json:

Run php -i (maybe save it to a file); that will give you a lot of configuration info. Near the top of the output, there would be some lines that look like Loaded Configuration File => /etc/php/7.4/cli/php.ini - possibly more then one. These are the configuration files PHP is using. You’ll need to edit one of them[1].

In the output of php -i, look for variables_order - that’s the current value. Note it down.

In the ini file you chose, look for variables_order - it should be listed there with some comments. If not, add it.
Set it to something like variables_order = EGPCS (that’s the default value according to my ini file).

Run php -i again to see if it got your change.

Running arc now should not try to run the exec in repairMissingVariablesOrder, and should not fail to parse the json.

[1] There’s also a list of possible ini files locations here PHP: The configuration file - Manual.