Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
FuelPHP - paragonie/sodium_compat
  • Hello,

    When checking my log files, I can see the following line :

    Fuel requires Sodium support in PHP. Either use PHP 7.2+, install the libsodium PECL extension, of the sodium-compat composer package! in fuel\core\vendor\paragonie.php on 33

    The package paragonie/sodium_compat is installed. Am I missing something?

    Thanks in advance.
  • I managed to resolve this by installing version 2.* of paragonie/random_compat.
  • A "composer update" would have addressed that?
  • Hi Harro,

    Tried that, but it kept on installing paragonie/random_compat v9.99.99, which, weirdly, doesn't contain any class nor function (?).

    Or maybe, I missed something...
  • Hmm.. Weird indeed.

    According to the commit, this is done to prevent it loading on PHP7, but I don't know why, only 7.2 has built-in support for libsodium...

    What PHP version are you on?
  • We're on 5.6.3.

    I probably got confused, it explicitly says :

    # For software that explicitly needs PHP 5 support:
    composer require paragonie/random_compat:\<9.99
    Got it working properly so it's all good.

    Thanks for the reply, Harro, as always!
  • I tried this but immediately got the error below, even after deleting to cookies and I cannot read out of the session. I've been trying to fight this for over an hour now. How did the fuel developers screw this one up so badly...

    Can not decode this string, no legacy crypt keys defined

    I have other instances running on FuelPhp1.8, when did this get broken?
  • It isn't broken afaik.

    If you get this message, it means Crypt::decode() gets a decoded string that is not encoded with the sodium keys in your crypt config file, and there are no legacy (pre-1.8.1) keys in your config file to try.

    It usually happens if you have existing cookies, either because you upgraded but didn't retain the old crypt keys, or you have cookies from another app and you reused the hostname.

    But you say you cleared all cookies, so that can't be it.

    I've had a look at the code, and I think it is possible to get this error if Crypt::decode() is called with an empty string as a value (which suggests something is wrong elsewhere as that should not happen).

    As a test, can you add:

    if ($value === "")
        return "";

    at the top of the decode() method in the Crypt class, and see if that fixes your error?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion