4
Error when using isset with new PHP methods:
<?php
require './fb.php';
if (isset(filter_input(INPUT_SESSION, "fb_access_token")) && !empty(filter_input(INPUT_SESSION, "fb_access_token"))):
echo "Ta logado!";
else:
header("Location: login.php");
endif;
Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in C:\wamp64\www\bw7\index.php on line 9
Already using global variables, it works:
<?php
require './fb.php';
if(isset($_SESSION["fb_access_token"])):
echo "Ta logado!";
else:
header("Location: login.php");
endif;
Why?
Can’t use
isset()
in expressions, you can switch toempty()
if the php version is 5.5 or higher.– rray
But filter_input(INPUT_SESSION, "fb_access_token") does not do the same thing as $_SESSION["fb_access_token"])?
– Lucas de Carvalho
I just saw that INPUT_SESSION has not been implemented yet.
– Lucas de Carvalho