Problem/Motivation
The following error keeps appearing in the logs. The issue seems to be coming from the data structure after it has been decrypted.
Steps to reproduce
Run this test
../vendor/bin/phpunit -c core ./modules/contrib/bakery/tests/src/Unit/KitchenTest.php
Example error
unserialize(): Extra data starting at offset 161 of 176 bytes
Proposed resolution
Right trim the decrypt string in function before it's unserialized
public function decrypt(string $text): string {
.....
return rtrim($data, "\0");//$data; <---- replace $data with rtrim($data, "\0");
}
Comments
Comment #2
avpadernoIt seems the used library adds extra NULL characters. See
phpseclib_mcrypt_generic_helper(), the helper function called by other functions (phpseclib_mdecrypt_generic(), for example.)Comment #4
avpadernoComment #5
purencool commentedComment #7
purencool commentedBefore merge
After merge
Comment #8
purencool commented