Posted by ZeldorBlat on 05/14/07 16:36
On May 14, 12:14 pm, carrion <hofmann.johan...@gmail.com> wrote:
> >...
> > > 3. can I get __autoload to help me out of this?
>
> > Absolutely. I highly recommend the use of __autoload() for a lot of
> > reasons, not the least of which is the problem you've described.
>
> > function __autoload($class_name) {
> > $fn = $class_name . '.php';
> > require_once $fn;
>
> > }
>
> Thanks for the quick response.
> However, autoload() doesn't do what it should.
>
> The code below is about all that happens in the css skript.
>
> //START
> session_start();
> $objController=$_SESSION['controller'];
> var_dump($objController);
> $objCssParser=new CssParser($objController);
> //END
>
> Now autoload() is triggered by the "new CSSParser" part and loads the
> whole hierarchy of CSSParser's parent classes and interfaces.
> But the unserializing doesn't bother it at all. The function is not
> called.
>
> So after that the type-hinting in CssParser's constructor causes an
> error to be thrown since it can't determine the class of
> $objController.
>
> Suggestions?
Try adding this immediately after you define __autoload():
ini_set('unserialize_callback_func', '__autoload');
[Back to original message]
|