banujan6/CSRF-handler

Undefined index: X-CSRF-TOKEN-LIST

Closed this issue · 3 comments

Hello,
first want to thank you for your great CSRF handler...

I have problem with

Undefined index: X-CSRF-TOKEN-LIST in vendor/banujan6/csrf-handler/src/csrfhandler/csrf.php on line 71

  • on that line is setToken function and if i putt

$_SESSION['X-CSRF-TOKEN-LIST'] = null;

There is no error,but $_SESSION['X-CSRF-TOKEN-LIST'] is different "shorter" - is this ok or ?

Hi @onebeat thanks for using this, Can you share your code?

Hello, @onebeat I just patched the issue. Please checkout version 2.1.

Hello, @banujan6 i have just seen your update but there is another problem, thing that you need patched

private static function startSession() { if(!isset($_SESSION["X-CSRF-TOKEN-LIST"]) && session_status() == PHP_SESSION_NONE){ session_start(); } $_SESSION["X-CSRF-TOKEN-LIST"] = null; // initializing the index }

If somebody has session class on there own, without this it will show "notice" that session already started - also i have moved your $_SESSION["X-CSRF-TOKEN-LIST"] out off IF loop :)