diff --git a/Changelog b/Changelog index 6de6eacba..15866a48d 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-01-28 DariusIII + * Chg: Make PHP7.2 lowest supported version, use sodium for bin2hex and hex2bin operations * Chg: Update theleague/flysystem to latest version * Chg: Replace time() with Carbon to prevent time conversion from unixtime * Chg: Replace openssl_random_pseudo_bytes with random_bytes diff --git a/app/Extensions/helper/helpers.php b/app/Extensions/helper/helpers.php index fb8a424e8..ba17a18f9 100644 --- a/app/Extensions/helper/helpers.php +++ b/app/Extensions/helper/helpers.php @@ -170,7 +170,7 @@ if (! function_exists('makeFieldLinks')) { $data[6] = \chr(\ord($data[6]) & 0x0f | 0x40); // set version to 0100 $data[8] = \chr(\ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 - return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); + return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(sodium_bin2hex($data), 4)); } } diff --git a/bootstrap/constants.php b/bootstrap/constants.php index 26eec15dc..646c9d285 100755 --- a/bootstrap/constants.php +++ b/bootstrap/constants.php @@ -2,7 +2,7 @@ // YOU SHOULD NOT EDIT ANYTHING IN THIS FILE, COPY .../ntmux/config/settings.example.php TO .../nntmux/config/settings.php AND EDIT THAT FILE! -define('NN_MINIMUM_PHP_VERSION', '7.1.0'); +define('NN_MINIMUM_PHP_VERSION', '7.2.0'); define('NN_MINIMUM_MYSQL_VERSION', '5.6'); define('NN_MINIMUM_MARIA_VERSION', '10.1'); diff --git a/composer.json b/composer.json index ce47b5f31..7306648ec 100755 --- a/composer.json +++ b/composer.json @@ -63,7 +63,7 @@ } ], "require": { - "php": ">=7.1.0", + "php": ">=7.2.0", "ext-ctype": "*", "ext-curl": "*", "ext-exif": "*", diff --git a/composer.lock b/composer.lock index f4efa6b54..63ffe4860 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "98bc283ec4e5bea5508234c158434de4", + "content-hash": "dce1c35059f570268458c205667e038d", "packages": [ { "name": "adrenth/thetvdb2", @@ -7924,7 +7924,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.1.0", + "php": ">=7.2.0", "ext-ctype": "*", "ext-curl": "*", "ext-exif": "*", diff --git a/nntmux/Binaries.php b/nntmux/Binaries.php index fe5554d2a..0532566cc 100755 --- a/nntmux/Binaries.php +++ b/nntmux/Binaries.php @@ -911,7 +911,7 @@ class Binaries Carbon::now()->toDateTimeString(), $xref, Carbon::now()->toDateTimeString(), - bin2hex($random) + sodium_bin2hex($random) ) ); diff --git a/nntmux/NZBImport.php b/nntmux/NZBImport.php index 8939a0442..696186390 100755 --- a/nntmux/NZBImport.php +++ b/nntmux/NZBImport.php @@ -483,6 +483,6 @@ class NZBImport */ protected function updateNzbGuid(): void { - Release::query()->where('guid', $this->relGuid)->update(['nzb_guid' => hex2bin($this->nzbGuid)]); + Release::query()->where('guid', $this->relGuid)->update(['nzb_guid' => sodium_hex2bin($this->nzbGuid)]); } } diff --git a/nntmux/ReleaseExtra.php b/nntmux/ReleaseExtra.php index 2b691a81d..8ab4d1b67 100755 --- a/nntmux/ReleaseExtra.php +++ b/nntmux/ReleaseExtra.php @@ -371,7 +371,7 @@ class ReleaseExtra ->orWhere( [ 'releases_id' => $releaseID, - 'uniqueid' => hex2bin($uniqueid), + 'uniqueid' => sodium_hex2bin($uniqueid), ] )->first(['releases_id']); if ($dupecheck === null) { @@ -379,7 +379,7 @@ class ReleaseExtra ->insert( [ 'releases_id' => $releaseID, - 'uniqueid' => hex2bin($uniqueid), + 'uniqueid' => sodium_hex2bin($uniqueid), ] ); } diff --git a/public/pages/BasePage.php b/public/pages/BasePage.php index 23b00509e..773e25845 100644 --- a/public/pages/BasePage.php +++ b/public/pages/BasePage.php @@ -104,7 +104,7 @@ class BasePage session_set_cookie_params(0, '/', '', $this->https, true); session_start(); if (empty($_SESSION['token'])) { - $_SESSION['token'] = bin2hex(random_bytes(32)); + $_SESSION['token'] = sodium_bin2hex(random_bytes(32)); } $this->token = $_SESSION['token']; }