Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt November 11, 2024
Numbered Posted January 16, 2018 Posted January 16, 2018 Let's see in \IPS\Session\Front class. When we read session IPS do some needed stuff in the last part this method fill $this>data array per each param. One of this key is $item->data['data']. It will fill with an inline condition: 'data' => $session ? $session['data'] : '', May be ok. But after this reading we calling write method, which should update some things. But it is not doing because first line checks this condition !isset( $this->data['data'] ) This condition will be false every time, because empty is exist. It never make a trouble when you use default IPS login handler or third party, oauth and something else. But it will reproduce if you start working with $this->data, $this->setMember(..) inside hook for \IPS\Session\Front. Then this data isn't store and you have a success logged in user with session, cookies, device and all, but without $this->data['data'] info in session and in database too. I'm sure first code quote shoud be 'data' => $session ? $session['data'] : NULL, With that we get a correct result <?php $content = ''; var_dump(!isset($content)); // return bool(false) $content = null; var_dump(!isset($content)); // return bool(true) With that condition will work and store data param to database (or to redis in 4.3 ) Thanks for your advice!
Numbered Posted January 16, 2018 Author Posted January 16, 2018 I was wrong. It's not a point of bug. Actually it's mine mistake. I did a sso file, where i create a hook to \IPS\Session\Front to the read method. As that doc said I can call a parent:read and before that check $this->member->member_id and if it exist - just return $result of parent::read. It's wrong. In some case member_id can be present at cookie, but the returned data is empty. But this method should return string. So this is a place of my throwned errors. The red underscode is source of my script down (actually it's right.. null is not a string..but) Without this hard check all is right.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.