Token [Class] - Updates for PHP 8.1
This commit is contained in:
@@ -81,7 +81,7 @@ class token {
|
|||||||
$key = preg_replace('[^a-zA-Z0-9]', '', $key);
|
$key = preg_replace('[^a-zA-Z0-9]', '', $key);
|
||||||
|
|
||||||
//get the token name
|
//get the token name
|
||||||
if (is_array($_SESSION['tokens'][$key]) && @sizeof($_SESSION['tokens'][$key]) != 0) {
|
if (!empty($_SESSION['tokens']) && is_array($_SESSION['tokens'][$key]) && @sizeof($_SESSION['tokens'][$key]) != 0) {
|
||||||
foreach ($_SESSION['tokens'][$key] as $t => $token) {
|
foreach ($_SESSION['tokens'][$key] as $t => $token) {
|
||||||
$token_name = $token['name'];
|
$token_name = $token['name'];
|
||||||
if (isset($_REQUEST[$token_name])) {
|
if (isset($_REQUEST[$token_name])) {
|
||||||
@@ -94,7 +94,7 @@ class token {
|
|||||||
$value = preg_replace('[^a-zA-Z0-9]', '', $value);
|
$value = preg_replace('[^a-zA-Z0-9]', '', $value);
|
||||||
|
|
||||||
//compare the hashed tokens
|
//compare the hashed tokens
|
||||||
if (is_array($_SESSION['tokens'][$key]) && @sizeof($_SESSION['tokens'][$key]) != 0) {
|
if (!empty($_SESSION['tokens']) && is_array($_SESSION['tokens'][$key]) && @sizeof($_SESSION['tokens'][$key]) != 0) {
|
||||||
foreach ($_SESSION['tokens'][$key] as $t => $token) {
|
foreach ($_SESSION['tokens'][$key] as $t => $token) {
|
||||||
if (hash_equals($token['hash'], $value)) {
|
if (hash_equals($token['hash'], $value)) {
|
||||||
$_SESSION['tokens'][$key][$t]['validated'] = true;
|
$_SESSION['tokens'][$key][$t]['validated'] = true;
|
||||||
@@ -110,7 +110,7 @@ class token {
|
|||||||
* clear previously validated tokens
|
* clear previously validated tokens
|
||||||
*/
|
*/
|
||||||
private function clear_validated() {
|
private function clear_validated() {
|
||||||
if (is_array($_SESSION['tokens']) && @sizeof($_SESSION['tokens']) != 0) {
|
if (!empty($_SESSION['tokens']) && is_array($_SESSION['tokens']) && @sizeof($_SESSION['tokens']) != 0) {
|
||||||
foreach ($_SESSION['tokens'] as $key => $tokens) {
|
foreach ($_SESSION['tokens'] as $key => $tokens) {
|
||||||
if (is_array($tokens) && @sizeof($tokens) != 0) {
|
if (is_array($tokens) && @sizeof($tokens) != 0) {
|
||||||
foreach ($tokens as $t => $token) {
|
foreach ($tokens as $t => $token) {
|
||||||
|
|||||||
Reference in New Issue
Block a user