Never mind, I just found and exceptable work around.
$GLOBALS["session"] & $GLOBALS["document"] contain the objects.
(and after all that typing :)
-Evan
On Wed, Jul 24, 2002 at 10:21:32PM -0400, Evan said:
> Hey all,
>
> I'm having a strange problem with objects that I'm hoping someone out there can
> help me track down. I'll give a run down of the setup here, please note that
> register_globals is off.
>
> A page creates two objects.
>
> $document - this is always a new object and uses the ob_ functions to control
> the output. ob_start is called with a customer callback that writes the output
> to a file based on $_SERVER variables.
>
> $session - this is an object that gets serialized whenever a request finishes
> and unserialized when the request begins.
>
> Each object uses register_shutdown_function(array($this, "desconstructor")) to
> set a hook to clean up after itself which works without problems.
>
> The following is then set.
> $document->session =& $session;
> $session->document =& $document;
>
> Everything works fine through out the page all properties of the session can be
> accessed and set via $session->whatever or $document->session->whatever and vice
> versa for the $document object.
>
> The problem arises when the $document->deconstructor function is called. As
> described above the ob_ callback fires and properly writes the captured output
> to a file then calls ob_end_clean() to dump the buffer and returns nothing, then
> right after the deconstructor function is called which does the following:
> include("a header file.php");
> include("the temp file from ob_");
> include("a footer file.php");
> unlink("the temp file from ob_");
>
> Now this works beautifully, except that some of the object properties get
> destoryed. For instance since the includes are called from
> $document->deconstructor it makes sense that $this should reference the document
> object and that $this->session should reference the session object, but the
> following happens. In the file I have this:
>
> $this is a <?=get_class($this)?><br>
> $tihs->session is a <?get_class($this->session)?><br>
>
> Which returns:
>
> $this is a rj_document
> $this->session is a
>
>
> Now I thought that it might be because the session object is destroyed before
> the document object fires its deconstructor call so when the objects are
> associated I changed the document line to be:
> $document->session = $session
> But I get the same results.
>
>
> Anyone have any insight?
>
>
> Thanks,
> Evan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php