Re: PEAR-wide code quality issue (fix proposal for possible class redeclare errors)
| From: | peter fiksman | Date: | Sun, 16 Jul 2006 11:47:20 +0000 |
| Subject: | Re: PEAR-wide code quality issue (fix proposal for possible class redeclare errors) | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-43490@lists.php.net to get a copy of this message | ||
Hello,
well, if you use a system with highly dynamic or even self-learning path
generation and discovery, the described situation with doubled require_once
for the same file could become an unpredictable case.
What are the real backdrawals of my proposal (to enclose class definitions
into an if-clause, preventing fatal error on double definition if occured)?
cheers,
Peter
----- Original Message -----
From: "Pierre" <pierre.php@gmail.com>
To: "peter fiksman" <pfiksman@gmx.net>
Cc: <pear-dev@lists.php.net>
Sent: Sunday, July 16, 2006 12:03 AM
Subject: Re: [PEAR-DEV] PEAR-wide code quality issue (fix proposal for
possible class redeclare errors)
> On 7/15/06, peter fiksman <pfiksman@gmx.net> wrote:
> >
> > Hello all,
> >
> > hearing all those irritated voices I still dare to ask...
> >
> > why can't be ALL classes defined like:
> >
> > ================================
> >
> > if ( !class_exists( "SOME_Package_And_Class_Name" ) ) {
> >
> > class SOME_Package_And_Class_Name
> > {
> > // code
> > }
> >
> > }
> > ================================
> >
> > I have got some "cannot redeclare" issues with autoloading classes and
this
> > was a really helpful fix (to PEAR classes...)
> >
> > If this is not dangerous at all (or is it?) maybe it could be possible
to
> > patch PEAR classes in this way.
> > Just preventing the redeclare fatal error?
>
> use require/include_once
>
> Cheers,
> --Pierre
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>