Open nuxwin opened 6 years ago
I think you are right. There should be a difference between a key is set and key exist. Maybe one can implement another method with name offsetIsSet, which uses isset and change method offsetExists to use array_key_exists.
This repository has been closed and moved to laminas/laminas-session; a new issue has been opened at https://github.com/laminas/laminas-session/issues/5.
@weierophinney @Ocramius
As said in the title, checking if specific offset exists when it is set with
NULL
value always returnFALSE
.The problem is that current implementation rely on PHP
isset()
language construct which returnFALSE
for keys withNULL
value. Shouldn't it be preferable to use the PHParray_key_exists()
function? What we want there is knonwing if a specific offset exists, whatever it value, right? Else, is there any reliable way to check if a particular key was set, whatever it value and without first having to get an array copy?Even worse is that trying to unset an offset with
NULL
value will lead to a NO OP because we return early fromZend\Session::AbstractContainer::offsetUnset()
if the offset isn't set in regard of theZend\Session::AbstractContainer::offsetExists()
current implementation:Thank you.