IIRC php sessions don't store the functions within objects, but only the
variables so the function calls are not there. This could cause the
incomplete object error. You may want to create another function that would
take the sessions variables and build a new object with them? I can not
remember where I read this, but it was possibly the Riders book Web
Application Development with PHP4.0
Chad
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Hossein S. Zadeh
> Sent: Wednesday, April 18, 2001 10:04 AM
> To: [EMAIL PROTECTED]
> Subject: A question on session management in PHP4
>
>
> Hi there,
> I have used session management in PHP3 (with PHPLIB), and in PHP4. No
> problem, I always thought,..... "elementary my dear....".
>
> Well, now I've stumbled over a small problem. In PHP4, I have tested the
> following code, and it works fine:
>
> <?php
> session_register("zzz");
> $zzz++;
> print $zzz;
> ?>
>
> As one expects, the above code increments the counter at every page
> reload.
>
> Recently, I started a new project, and I decided to use object oriented
> facilities of PHP. I have placed a class definition in one file:
>
> class whatever{
> ...
> ...
> function what(){
> ...
> }
> }
>
> In another file I create an instance of the object:
>
> <?php
> include "1st file"
> $x = new whatever();
> $x->what();
> ?>
>
> OK, so far so good; it works fine. But I would like to register $x in the
> 2nd file as a session variable (I'd like to keep it in between page
> reloads/form submits). I have changed the 2nd file to:
>
> <?php
> include "1st file"
> session_register("x");
> if (some-condition){
> $x = new whatever();
> }
> $x->what();
> ?>
>
> Note that (some-condition) is true the first time the page is loaded. This
> is to create the new instance the first time the page is hit, but not
> re-create it for subsequent visits (during one session that is). On trying
> to load the file, I get the following error:
>
> Fatal error: The script tried to execute a method or access a property of
> an incomplete object. Please ensure that the class definition whatever of
> the object you are trying to operate on was loaded _before_ the session
> was started in /home/blah/public_html/test.php on line 4
>
>
> Any ideas?
>
> Hossein
>
>
>
>
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list
>
_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list