Re: Sessions, redirects and setFlash

2008-01-21 Thread Mr-Yellow

http://au2.php.net/session_write_close

The discussion here seems to indicate a PHP problem of some kind on
some systems.
or
Some missing stuff in cake to garbage collect for all situations?
or
Well my problem seems to point elsewhere.. __start in setFlash?

I encounter the problem with 1.2 + setFlash + redirect. However my old
session data (set on previous writes) still exists.
Anything set with Session-write works also, while the rest of the
setFlash array is present also.

Just the message is missing.

$this-Session-setFlash('foobar');
$this-Session-write('foo','bar');
$this-redirect(array('controller'='users','action'='login'), null,
true);

Resulting debug of $_SESSION:

[Message] = Array
(
[flash] = Array
(
[message] =
[layout] = default
[params] = Array
(
)

)

)
[foo] = bar

-Ben

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-21 Thread Mr-Yellow

debug(compact('message', 'layout', 'params'));

Array
(
[message] = foobar
[layout] = default
[params] = Array
(
)

)

That's the debug from the compact that goes into the write inside
setFlash.

-Ben

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-21 Thread Mr-Yellow

Ok I've been through it from top to bottom on the writing side of
things, sessions, flash code etc.

Seems that there is something cleaning up the message value before it
gets to the session helper $session-flash();

Before the view (debug($_SESSION) at the top and no message). the
message is deleted but everything else remains, even the flash related
array.

Then once $session-flash(); is called in the view the remaining flash
array entries are cleaned up.

-Ben

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-21 Thread Mr-Yellow

Ok got it on my end.. Hopefully this can help some others.

Problem is in the example code for DAuth user login controller.

$this-DAuth-newSalt();
$this-Session-setFlash($error);

This resets the message all the time with a blank var ($error is blank
unless there has been one)

Mod to something like this:

$this-DAuth-newSalt();
if (!$this-Session-check('Message.flash')  $error != '') {
   $this-Session-setFlash($error);
}

-Ben



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-15 Thread lordG

I mean wouldn't

On Jan 15, 11:05 am, lordG [EMAIL PROTECTED] wrote:
 Ok, yeah, the print_r would work as the session has not been started
 yet.

 However, there does appear to be a difference between when sessions
 start for normal requests and ajax requests.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-15 Thread lordG

Ok, yeah, the print_r would work as the session has not been started
yet.

However, there does appear to be a difference between when sessions
start for normal requests and ajax requests.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-15 Thread lordG

Ok, traced it down to the bare variable and these lines in the session
component:

00295 function __start(){
00296 if ($this-__started === false) {
00297 if ($this-__bare === 0) {
00298 if (!$this-id()  parent::start()) {
00299 $this-__started = true;
00300 parent::_checkValid();
00301 } else {
00302 $this-__started = parent::start();
00303 }
00304 }
00305 }
00306 return $this-__started;
00307 }

Is this intended functionality? What if the call needs to maintain a
session state, but is a bare = 1, like an ajax call?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-15 Thread lordG

Does anyone have any further suggestions on this?

I cake 1.1 my ajax calls would work 100% with a session security set
to medium. With Cake 1.2 however they are no longer working.

It seems to have something to do with the $_SESSION array being
undefined when the response is received.

Shouldn't the $_SESSION have the correct information in it? I do a
print_r($_SESSION) right at the beginning of the index.php file and I
get the undefined error.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-15 Thread lordG

ok... does anyone know why the following the the router are being
deprecated?

00503 /**
00504  * Deprecated
00505  *
00506  */
00507 $_this-connect('/bare/:controller/:action/*',
array('bare' = '1'));
00508 $_this-connect('/ajax/:controller/:action/*',
array('bare' = '1'));

I had to mod the ajax one to:
00508 $_this-connect('/ajax/:controller/:action/*',
array('bare' = '1', 'ajax' = '1'));

So that I could mod the sessionComponent to start the session if it
was a ajax call.

sessionComponent...

lines 79 - 86:
function initialize($controller) {
if (isset($controller-params['bare'])) {
$this-__bare = $controller-params['bare'];
}
if (isset($controller-params['ajax'])) {
$this-__ajax = $controller-params['ajax'];
}
}

lines 298 - 312:
function __start(){
print_r($this-__webservice);
if ($this-__started === false) {
//if ($this-__bare === 0) {
if ($this-__bare === 0 || ($this-__ajax == 1  
$this-__bare ===
1)) {
if (!$this-id()  parent::start()) {
$this-__started = true;
parent::_checkValid();
} else {
$this-__started = parent::start();
}
}
}
return $this-__started;
}


What are webserivce ones becoming and will session state be
maintainable with webservices and ajax?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-14 Thread lordG

Hey Chris, yeah I had a similar problem before with 1.1 and did then
and now downscaled the security to medium.

What is the difference between the 3 levels though, other than the
timeout scale time?

Chris Hartjes wrote:
 On Jan 13, 2008 6:24 PM, lordG [EMAIL PROTECTED] wrote:
 
  Hi guys,
 
  I'm experiencing a problem with the redirects when I destroy the
  session, set a flash message and then redirect.
 
  When it gets to the redirect page, the flash no longer exists and the
  session is clean of any custom session data they may have been set
  after the destroy call.
 
  Does the redirect do anything with regards to the Sessions if they
  have been just been destroy'd and renew'd?
 
  I noticed the session_write_close call, but that just locks the
  session and shouldn't affect the session data.
 
  Very weird.
  G

 First thing to check when sessions go haywire is your security level
 in config/copre.php.  Make sure it's set to low, as on high it
 regenerates the session on every refresh (or so I remember being
 told).

 Hope that helps.

 --
 Chris Hartjes
 Internet Loudmouth
 Motto for 2008: Moving from herding elephants to handling snakes...
 @TheKeyBoard: http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-13 Thread GrĂ¡inne O'Neill
i'm having the same problem.  (except minus the flash)

ugh...

On Jan 13, 2008 5:24 PM, lordG [EMAIL PROTECTED] wrote:


 Hi guys,

 I'm experiencing a problem with the redirects when I destroy the
 session, set a flash message and then redirect.

 When it gets to the redirect page, the flash no longer exists and the
 session is clean of any custom session data they may have been set
 after the destroy call.

 Does the redirect do anything with regards to the Sessions if they
 have been just been destroy'd and renew'd?

 I noticed the session_write_close call, but that just locks the
 session and shouldn't affect the session data.

 Very weird.
 G
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sessions, redirects and setFlash

2008-01-13 Thread Chris Hartjes

On Jan 13, 2008 6:24 PM, lordG [EMAIL PROTECTED] wrote:

 Hi guys,

 I'm experiencing a problem with the redirects when I destroy the
 session, set a flash message and then redirect.

 When it gets to the redirect page, the flash no longer exists and the
 session is clean of any custom session data they may have been set
 after the destroy call.

 Does the redirect do anything with regards to the Sessions if they
 have been just been destroy'd and renew'd?

 I noticed the session_write_close call, but that just locks the
 session and shouldn't affect the session data.

 Very weird.
 G

First thing to check when sessions go haywire is your security level
in config/copre.php.  Make sure it's set to low, as on high it
regenerates the session on every refresh (or so I remember being
told).

Hope that helps.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: Moving from herding elephants to handling snakes...
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---