libsodium-php
libsodium-php copied to clipboard
`sodium_crypto_pwhash_str` end up with `Uncaught SodiumException: internal error`
print_r(explode('$', sodium_crypto_pwhash_str('string',SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE)));
Ends up with:
Fatal error: Uncaught SodiumException: internal error in /in/4adjf:3
Stack trace:
#0 /in/4adjf(3): sodium_crypto_pwhash_str()
#1 {main}
thrown in /in/4adjf on line 3
Process exited with code 255.
Since PHP 8.1.2 on some platforms.
https://3v4l.org/4adjf
What does phpinfo() say about libsodium library & extension versions?
We use exactly the same Docker image on all the environments:
Configure Command => './configure' '--build=aarch64-linux-gnu' '--with-config-file-path=/usr/local/etc/php' '--with-config-file-scan-dir=/usr/local/etc/php/conf.d' '--enable-option-checking=fatal' '--with-mhash' '--with-pic' '--enable-ftp' '--enable-mbstring' '--enable-mysqlnd' '--with-password-argon2' '--with-sodium=shared' '--with-pdo-sqlite=/usr' '--with-sqlite3=/usr' '--with-curl' '--with-iconv' '--with-openssl' '--with-readline' '--with-zlib' '--enable-phpdbg' '--enable-phpdbg-readline' '--with-pear' '--with-libdir=lib/aarch64-linux-gnu' '--enable-embed' 'build_alias=aarch64-linux-gnu'
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
sodium
sodium support => enabled
libsodium headers version => 1.0.18
libsodium library version => 1.0.18
Not enough memory, maybe? What happens if you set the memory limit to something small?
With 256M of memory, the same result: https://3v4l.org/AHABm Also, in the CI environment, we have 2G of memory limit for CLI (you know, Magento)

Do you know of a way to reproduce this? I tried the PHP package from Homebrew and couldn't duplicate this.
@jedisct1 I was able to reproduce that with 3v4l and with Gitlab CI environments. Can't reproduce that with the same Docker image on a local environment (Macbook M1)