Posted by Colin McKinnon on 10/03/83 11:26
sandy wrote:
>
> So, I've been trying to learn how php sessions work.
> I'm new at php sessions. Bear with me.
>
<snip>
> session_start();
> $test_class = new TestClass();
> session_register('test_class')
>
>
> So, if $REQUEST_METHOD=='POST'
> {
> I can say:
> $test_class->show();
> ...and it works. So php must have automatically
> serialized the class for me. So why and when
> do you ever need to explicitly say something
> about serialize($this) or unserialize($that)
> ...when the system seems to be doing it anyway.
>
> }
>
You're writing your code assuming that register_globals is on - not a good
idea, particularly when you're learning.
In answer to your question - 'cos sometimes you may want to keep an object
somehwere other than the session.
C.
[Back to original message]
|