[dev] Re: [cvs] commit: horde/lib Data.php

Jan Schneider jan@horde.org
Fri Nov 22 12:13:00 2002


Zitat von Chuck Hagenbuch <chuck@horde.org>:

> Quoting Jan Schneider <jan@ammma.de>:
> 
> > Log:
> > You always learn something new. If you use static methods of a class
> that
> > extends PEAR inside of another class, this class also needs to extend
> PEAR
> > because $this as used inside of PEAR would be a reference to the
> outermost
> > class.
> 
> Eh.... oh. This is a bug in PEAR, really. Sounds like a method that tries
> to
> tell if it's called statically or not, and doesn't check properly.
> Extending
> PEAR probably makes things just more subtly broken, since the _wrong_
> $this
> pointer will probably be used.
> 
> Where does this happen?

In the PEAR error handler routines. There are several isset($this) checks to
call methods raiseError() either statically or by object reference. The
problem occurs because inside instantiated Data/Data_csv objects we call all
methods of File_CSV:: statically. If there happens to be an error inside
this class, it calls raiseError() that includes the broken isset() checks.

I didn't find another solution but extending Data from PEAR so that the
expected methods really exist in the $this context.

Now that I slept a night about it, it should also work if we just don't use
File_CSV statically but instantiate an object from it. I'll try this out as
I'm currently refactoring the whole import/export framework anyway.

Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft


More information about the dev mailing list