Here's the text I'm trying to post on site now regarding your
submission, but there's a server problem at the moment, so I can't make
the submission...
----------------------------------------------------
@Louis: Thanks! That's excellent...
But would you be open to enhancing by also detecting a session ID on
query strings? I think in some ways that could be more useful, as unlike
document.cookie, the settings made here could be made to propagate to
other pages (I remember something about sessions causing all URLs on the
page to be rewritten with that session query string--wouldn't be too
hard to do in DOM/JavaScript either, and pretty convenient actually
(maybe even in combination with Ajax, though I haven't had time to think
through it much).
You might take a look at
http://phpjs.org/functions/import_request_variables:431 for how we did
it for that function. Also, we can even make use of ini_get to make use
of some settings at
http://www.php.net/manual/en/session.configuration.php like
session.use_cookies or session.use_only_cookies ...
Also, we can use our own ini setting (e.g., "phpjs.sessionObj") to
create an alternate object instead of $_SESSION (in case someone wants
better namespacing).
Anyhow, thanks again for the submission!
> return secure&& r.push('secure'), w.document.cookie = r.join(";"),
Just letting you know I'm going to try to do your functions this weekend
and have already implemented a few minor (PHP-deprecated) functions and
added them to _experimental:
http://github.com/kvz/phpjs/commit/4c64dcd9857ac31b7f8b693d2354111ec78a7a77
. As you can/could see there, if the user has added $_SESSION to the
namespaced object, they can avoid using it on the window object (the
default).
I also fixed your unit test to work with the 2nd page again apparently
because you added a session destroy as the last test and so there was no
more session to pass to the next page:
http://github.com/kvz/phpjs/commit/ff0e9ff2063e3e7045ba9a50baeb1f0ac25754e2
. Good thing for your unit tests or otherwise I wouldn't have noticed
this! :)
best wishes,
Brett
On 8/23/2010 6:12 PM, Louis Stowasser wrote:
> return secure&& r.push('secure'), w.document.cookie = r.join(";"),
Through the query string would be good. Would need to find every link and append the HREF with it though.
How would the user change the setting so to have a custom namespaced $_SESSION object
var someObj = {}; ini_set('phpjs.sessionObject', someObj);
or use GET instead of cookies?
ini_set('session.use_cookies', 0);
Oops, forgot I was testing session_destroy. Gotta love unit tests ;)