CLI Updater fails with no error on Windows


#1

On Windows 10 the CLI updater fails to update but gives success message

$ bin/console pimcore:update --version --env=dev
Pimcore 5.0.0-BETA1 (kernel: app, env: dev, debug: true)

$ bin/console pimcore:update -u 128 --env=dev
You are going to update to build 128! Continue with this action? (y/n)y
Starting the update process ...
 98/98 [============================] 100%

Update done!

$ bin/console pimcore:update --version --env=dev
Pimcore 5.0.0-BETA1 (kernel: app, env: dev, debug: true)

As you can see from the above, the version before and after update is 5.0.0-BETA1 although it reports the update was successful. The dev_log shows no sign of error either.

I know Windows isn’t supported but unfortunately I have to develop on Windows although we deploy to a Linux server. Is there anything I’m doing wrong here?


#2

Hi, do you have any infos in your php log?


#3

I tried running the first few directly in PowerShell and they all responded {“success”:true}
I really hope I’m not doing something stupid!

The following is from dev.log:
The database updates appear to work fine so I’ve ommited most of these entries.

[2017-09-27 15:32:15] doctrine.DEBUG: CREATE TABLE IF NOT EXISTS _tmp_update ( id int(11) NULL DEFAULT NULL, revision int(11) NULL DEFAULT NULL, path varchar(255) NULL DEFAULT NULL, action varchar(50) NULL DEFAULT NULL ); [] []
[2017-09-27 15:32:16] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : composer-invalidate-classmaps }" on the current shell [] []
[2017-09-27 15:32:17] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :93, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:17] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :94, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:18] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :95, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:18] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :96, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:19] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : preupdate , revision : 97 }" on the current shell [] []
[2017-09-27 15:32:19] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :97, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:20] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : postupdate , revision : 97 }" on the current shell [] []
[2017-09-27 15:32:20] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :98, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:21] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :99, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:21] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : preupdate , revision : 100 }" on the current shell [] []
[2017-09-27 15:32:21] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :100, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:22] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : postupdate , revision : 100 }" on the current shell [] []
[2017-09-27 15:32:22] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :101, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:23] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :102, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:23] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :103, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:24] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :104, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:24] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :105, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:25] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :106, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:25] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :107, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:26] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :108, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:26] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :109, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:26] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :110, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:27] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :111, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:27] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :112, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:28] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :113, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:28] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :114, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:29] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :115, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:29] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :116, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:30] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :117, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:30] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :118, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:31] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :119, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:31] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :120, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:32] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :121, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:32] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :122, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:32] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :123, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:33] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :124, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:33] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :125, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:34] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :126, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:34] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :127, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:35] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : files , revision :128, updateScript : false }" on the current shell [] []
[2017-09-27 15:32:35] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : clearcache }" on the current shell [] []
[2017-09-27 15:32:36] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : cleanup }" on the current shell [] []
[2017-09-27 15:32:36] pimcore.DEBUG: Executing command php C:\WebDev\workspace-oxygen\www.example.com\bin\console --env=dev internal:update-processor --ignore-maintenance-mode "{ type : composer-update }" on the current shell [] []
[2017-09-27 15:51:55] doctrine.DEBUG: DROP TABLE IF EXISTS _tmp_update [] []


#4

Making progress on this

The problem appears to be that the $config value in InternalUpdateProcesorCommand::execute is not valid JSON.

$job = json_decode($config, true);

The value of $job was null meaning the code continued without indicating any error.

The actual problem looks to be to do with the unescaped strings in the JSON:

I tried upgrading from build 92 to 93 and when I changed the following
FROM
"{ type : files , revision :93, updateScript : false }"
TO
'{"type":"files", "revision":93, "updateScript":false}'
the upgrade completed successfully

I just hard-wired the above change for testing. Will need to figure out where the json gets constructed now…


#5

Finally found the root of my problem. It’s in UpdateCommand::execute

$return = Console::runPhpScript($script, 'internal:update-processor --ignore-maintenance-mode ' . escapeshellarg(json_encode($job)));

From the manual:

On Windows, escapeshellarg() instead replaces percent signs, exclamation marks (delayed variable substitution) and double quotes with spaces and adds double quotes around the string.

Looks like escapeshellarg on Windows breaks the JSON formatting, and that this will affect any command-line operation on Windows that contains arguments.


#6

Hi,
thanks for investigating and sharing your solution and sorry for my late answer.
Could you create an issue at github so we can discuss internally if we have any options to change that?

Thanks…


#7

No problem - that’s it added on Github: