erikdubbelboer/phpRedisAdmin

1.14 version breaks under PHP<7

Closed this issue · 5 comments

Commit b9039ad introduces incompatibility with PHP<7 as it uses random_bytes function not available before PHP 7.0.
Reading composer.lock file I see, that PHP 5.3.9 should be sufficient to run phpRedisAdmin so I consider this issue as a bug.
If random_bytes is irreplaceable then maybe https://github.com/paragonie/random_compat should be used for PHP<7.

Should be fixed in the latest version. I have added random_compat as you suggested 👍 Thanks!

Is there any preferred way to use random_compat without composer? I've managed to edit common.inc.php but i'd like to avoid doing it every release.

It's mentioned here under the "Manual installation" section here: https://github.com/paragonie/random_compat#installing

I've read that documentation earlier and I had to do two things:

  1. Put random_compat's lib folder into phpRedisAdmin directory.
    2, Modify phpRedisAdmin source file common.inc.php to include ../lib/random.php file.
    I'd like to avoid the 2nd step for every phpRedisAdmin release.

And the question is, if it's possible to check in the /includes/common.inc.php file for random_compat function and if not found require /lib/random.php file if it exist.

Something like:
if (!is_callable('random_bytes') && file_exists(PHPREDIS_ADMIN_PATH . '/lib/random.php')) {
require PHPREDIS_ADMIN_PATH. '/lib/random.php';
}

Alternatively lib folder might be located under vendor directory.

I'm curious, why can't you use composer?

I'm ok with adding this code, can you make a pull request and can you add proper documentation on how to use it for others?