|
Posted by carrion on 05/14/07 16:51
On 14 Mai, 18:47, carrion <hofmann.johan...@gmail.com> wrote:
> On 14 Mai, 18:36, ZeldorBlat <zeldorb...@gmail.com> wrote:
>
>
>
> > 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');
>
> Good idea, that almost did the trick.
> I say almost since now i get one call to __autoload for the Controller
> class that is loaded.
> However that also doesn't take care of the inner objects.
>
> Yet... if i can load the containing class, maybe i can use it's
> __wakeup method to require the other files as needed...
> Anyone tried that? Or is there a chicken/egg problem?
>
> Greetings,
>
> Johannes
by the way, i can't post for an hour or so.
Navigation:
[Reply to this message]
|