Monday, March 28, 2011

Re: $this->Session->valid() strangely returning false

$this->Session->valid() isn't listed as an official method in 1.3
http://book.cakephp.org/view/1466/Methods

Perhaps you want to try:

if($this->Session->check('somvar') == true) {
 // Session exists
} else {
 // Session does not exist
}

On 27 March 2011 19:09, Roland Pish <rolandpish@gmail.com> wrote:
Hello there.

I have this code:

$this->Session->write('somevar',array(1,6)); // Creating somevar test
session variable
debug($this->Session->read()); // Dumping session contents. NOTE: this
displays correctly the contents of "somevar"
if ($this->Session->valid()) {
   debug('Session is valid');
}
else {
   debug('Session is NOT valid');
}

But $this->Session->valid() always returns false. Why does this happen
if a line before I can successfully print the contents of "somevar"
session variable?

Thanks in advance.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Kind Regards
 Stephen

 http://www.ninjacodermonkey.co.uk


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: