CodeIgniter Forums
Session problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Session problem (/showthread.php?tid=77340)



Session problem - luna80 - 08-19-2020

I to all.
I have a problem with the session variable. When I try to access to it I get this error. The session file is created correctly but I can do nothing.

Code:
Fatal error: Uncaught ErrorException: print_r(): Property access is not allowed yet in /mnt/data/Workspace/mysite/system/Log/Logger.php:463 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'print_r(): Prop...', '/mnt/data/Works...', 463, Array) #1 /mnt/data/Workspace/mysite/system/Log/Logger.php(463): print_r(Array, true) #2 /mnt/data/Workspace/mysite/system/Log/Logger.php(347): CodeIgniter\Log\Logger->interpolate('print_r(): Prop...', Array) #3 /mnt/data/Workspace/mysite/system/Common.php(756): CodeIgniter\Log\Logger->log('critical', 'print_r(): Prop...', Array) #4 /mnt/data/Workspace/mysite/system/Debug/Exceptions.php(156): log_message('critical', 'print_r(): Prop...', Array) #5 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #6 {main} thrown in /mnt/data/Workspace/mysite/system/Log/Logger.php on line 463

Fatal error: Uncaught ErrorException: print_r(): Property access is not allowed yet in /mnt/data/Workspace/mysite/system/Log/Logger.php:463 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'print_r(): Prop...', '/mnt/data/Works...', 463, Array) #1 /mnt/data/Workspace/mysite/system/Log/Logger.php(463): print_r(Array, true) #2 /mnt/data/Workspace/mysite/system/Log/Logger.php(347): CodeIgniter\Log\Logger->interpolate('Uncaught ErrorE...', Array) #3 /mnt/data/Workspace/mysite/system/Common.php(756): CodeIgniter\Log\Logger->log('critical', 'Uncaught ErrorE...', Array) #4 /mnt/data/Workspace/mysite/system/Debug/Exceptions.php(156): log_message('critical', 'Uncaught ErrorE...', Array) #5 /mnt/data/Workspace/mysite/system/Debug/Exceptions.php(224): CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException)) #6 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() #7 {main} thrown in /mnt/data/Workspace/mysite/system/Log/Logger.php on line 463


Thanks to all in advance, if more informations are needed let me know.


RE: Session problem - luna80 - 08-19-2020

The problem happen if in my .env I have

Code:
CI_ENVIRONMENT = development

If I set CI_ENVIRONEMENT to production the set of the session works but not unset.

How can I solve it?

Thanks


RE: Session problem - InsiteFX - 08-20-2020

In what way are you trying to access it? We need to see some code to be able to help you.


RE: Session problem - luna80 - 08-23-2020

I use this

to set
Code:
$this->session->set('utente', $utente);

to read
Code:
$this->session->get('utente')

but 

Code:
print_r($this->session->get());

return only
Code:
Array ( [__ci_last_regenerate] => 1598244195 )



RE: Session problem - InsiteFX - 08-24-2020

What version of CodeIgniter are you running?

You can get the developer version here that is always more up to date.

CodeIgniter 4 Developement Branch


RE: Session problem - Chroma - 08-27-2020

So, looking at the source code of Logger we see this:

PHP Code:
if (isset($_SESSION))
{
    
$replace['{session_vars}'] = '$_SESSION: ' print_r($_SESSIONtrue);



So my question to you is, what values are you putting into the session and what values where in it before? This might be important.


RE: Session problem - luna80 - 08-27-2020

Thanks a lot to all, I solved my problem by using the development branch as suggested by InsiteFX...I don't know if my problem was a bug or not but I didn't have more time to indagate.
If I'll some time I'll try to undestand the problem and I'll update this discussion in case someone has the same problem.

Many thanks