Fatal error: Call to undefined function Lockr\KeyWrapper\random_bytes()

Created on 2 January 2024, 11 months ago

Problem/Motivation

In a D7 site using PHP 5.6, adding a key to the UI and selecting "Lockr" as the Key Provider results in the following error:

Fatal error: Call to undefined function Lockr\KeyWrapper\random_bytes() in /code/sites/all/modules/contrib/lockr/vendor/lockr/lockr/src/KeyWrapper/LockrAes256CbcSha256RawKeyWrapper.php on line 26

Steps to reproduce

  1. Working on a D7 site using PHP 5.6 ...
  2. Add an authentication type key via the Key module UI, and select "Lockr" as the Key Provider.
  3. Click Save key.

Proposed resolution

The random_bytes() function was introduced with PHP 7 - to fix this issue, replace it with drupal_random_bytes(), which works with PHP 5.6.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States chill5-0

Live updates comments and jobs are added and updated live.
  • PHP 5.6

    The issue particularly affects sites running on PHP version 5.6.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024