nette/http

Argument 1 passed to Nette\Http\SessionSection::__isset() must be of the type string, null given

milo opened this issue · 2 comments

milo commented

Version: 3.0.2

Bug Description

Calling $session[null] cause type error. I used to have it in one control:

$id = $this->db->query(...)->fetchSingle();
if (isset($session[$id])) {
    ...
}

which worked well in in 2.4.11 but fails in 3.0.2.

Steps To Reproduce

require __DIR__ . '/vendor/autoload.php';

$request = (new Nette\Http\RequestFactory)->createHttpRequest();
$response = new Nette\Http\Response;
$session = (new Nette\Http\Session($request, $response))->getSection('test');

isset($session[null]);

Possible Solution

Maybe remove typehint from SessionSection::__isset() or change it to ?string or close this issue as expected behaviour :o) Not sure what is correct.

dg commented

I would rather say that it is correct now…

milo commented

I have no reason to oppose, so OK :)