Reply to Re: Autoloading class definitions of composed objects on unserialize() from session

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация