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.
Use an upper case checksum in the extension's XML file on the update server and run the Joomla! 'one-click' update routine.
Update without problems
'Checksum failed' error and update aborted.
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
Labels |
Added:
?
|
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...
Take a look here: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests#Identify_the_change_you_would_like_to_made
Great, thanks. I'll give it a go!
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-10-21 12:00:29 |
Closed_By | ⇒ | alikon |
Hi, can you send that proposed change as PR against the staging branch?