You are here: Re: Autoloading class definitions of composed objects on unserialize() from session « PHP Programming Language « IT news, forums, messages
Re: Autoloading class definitions of composed objects on unserialize() from session

Posted by carrion on 05/14/07 16:14

>...
> > 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?

 

Navigation:

[Reply to this 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

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