?
avatar innato
innato
20 Oct 2020

I have developed a Joomla! 4 plug-in that includes an SHA256 checksum in the update server XML file (Joomla! 'one-click' update routine).
The checksum string in the XML file is in capitals only.
When updating the extension through Joomla! 4, the checksum fails and the extension is not updated.

When changing line 379 in Joomla! core file /libraries/src/Installer/InstallerHelper.php
from:
if ($hashPackage !== $hashRemote)

into:
if (strtolower($hashPackage) !== strtolower($hashRemote))

the problem disappears.

It turned out, that the checksum generated by Joomla! (variable $hashPackage) is all lower case, while the checksum in the XML from the update server (variable $hashRemote) is upper case.

Changing the checksum in the update server XML to all lower case also resolves the issue, BUT including a case change in the Joomla! code (like above) will make the checksum procedure more foregiving and flexible.

NOTE: I have used the MD5 & SHA Checksum Utility from Raymond Lin (https://raylin.wordpress.com) to generate the checksum in the update server's XML file. This utility generates an upper case checksum.

Steps to reproduce the issue

Use an upper case checksum in the extension's XML file on the update server and run the Joomla! 'one-click' update routine.

Expected result

Update without problems

Actual result

'Checksum failed' error and update aborted.

System information (as much as possible)

Joomla! 4 standard (default) install on localhost, using WAMP32 server.

PHP Built On: Windows NT RCMJPC 10.0 build 18363 (Windows 10) i586
Database Type: mysql
Database Version: 5.7.27
Database Collation: utf8_general_ci
Database Connection Collation: utf8mb4_general_ci
Database Connection Encryption: None
Database Server Supports Connection Encryption: No
PHP Version: 7.4.11
Web Server: Apache/2.4.33 (Win32) PHP/7.4.11
WebServer to PHP Interface: apache2handler
Joomla! Version: Joomla! 4.0.0-beta4 Beta [ MaƱana ] 15-September-2020 13:46 GMT
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0

Additional comments

avatar innato innato - open - 20 Oct 2020
avatar joomla-cms-bot joomla-cms-bot - change - 20 Oct 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Oct 2020
avatar innato innato - change - 20 Oct 2020
The description was changed
avatar innato innato - edited - 20 Oct 2020
avatar innato innato - change - 20 Oct 2020
The description was changed
avatar innato innato - edited - 20 Oct 2020
avatar innato innato - change - 20 Oct 2020
The description was changed
avatar innato innato - edited - 20 Oct 2020
avatar innato innato - change - 20 Oct 2020
The description was changed
avatar innato innato - edited - 20 Oct 2020
avatar zero-24
zero-24 - comment - 20 Oct 2020

Hi, can you send that proposed change as PR against the staging branch?

avatar innato
innato - comment - 21 Oct 2020

Hi, can you send that proposed change as PR against the staging branch?

I have no idea what this means, sorry for that. Github remains partly a mystery to me...

avatar innato
innato - comment - 21 Oct 2020
avatar innato
innato - comment - 21 Oct 2020

@zero24 I think I cracked it. Should I have created a PR to start with? i.e. it's not an 'issue'?
Must/can I delete the above issue?
Thanks for your direction!

avatar zero-24
zero-24 - comment - 21 Oct 2020

Right you can close here as the PR has been created here: #31182

avatar alikon
alikon - comment - 21 Oct 2020

closing as we have a pr #31182

avatar alikon alikon - change - 21 Oct 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-10-21 12:00:29
Closed_By alikon
avatar alikon alikon - close - 21 Oct 2020

Add a Comment

Login with GitHub to post a comment