Re: __PHP_Incomplete_Class Object
| From: | Ernest E Vogelsinger | Date: | Thu, 30 Jan 2003 09:40:58 +0000 |
| Subject: | Re: __PHP_Incomplete_Class Object | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133618@lists.php.net to get a copy of this message | ||
At 06:20 30.01.2003, Weston Houghton said:
--------------------[snip]--------------------
>I'm trying to register an object in the session, and access that object
>from 2 different pages.
>
>I start off in the first file, and do:
><?php
>include("nycmgMail.php");
>session_start();
>$myMailer = new nycmgMail();
>
> ...
>
>If I print_r the $_SESSION on that page, everything looks fine. So I
>then move to my second page, and use:
>
>...
>
>Now when I do this, if I look at the $_SESSION object I see that that
>class is now listed as:
>[myMailer] => __PHP_Incomplete_Class Object
--------------------[snip]--------------------
You need to include the class definition of an object _before_
instantiating it. If you omit the class definition, PHP has no chance to
assign the correct class and uses a builtin default class.
Include your class definition file before session_start() and you'll be fine.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/