jeudi 8 octobre 2020

Laravel sporadic EncryptException "Could not encrypt the data." in EncryptCookies

We have a CentOS LAMP server with PHP5.6.37, openSSL 1.0.2, Laravel 5.4.

Sporadically we receive the following error:

exception 'Illuminate\Contracts\Encryption\EncryptException' with message 'Could not encrypt the data.' in ./Illuminate/Encryption/Encrypter.php:95
Stack trace:
 #0 ./Illuminate/Cookie/Middleware/EncryptCookies.php(131): Illuminate\Encryption\Encrypter->encrypt('KoKVTECWZF4A8x7...')
 #1 ./Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Cookie\Middleware\EncryptCookies->encrypt(Object(Illuminate\Http\Response))

The problematic code is:

$json = json_encode(compact('iv', 'value', 'mac'));
if (!is_string($json)) {
    throw new EncryptException('Could not encrypt the data.');
}

These exceptions happen sporadically, all in the early morning hours (3AM-8AM) , sometimes there are no errors for couple of weeks, then they happen every consecutive day.

ATM we cannot switch to PHP7.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire