Re: PEAR-wide code quality issue (fix proposal for possible class redeclare errors)

From: Date: Sun, 16 Jul 2006 18:25:43 +0000
Subject: Re: PEAR-wide code quality issue (fix proposal for possible class redeclare errors)
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-43497@lists.php.net to get a copy of this message
peter fiksman wrote: > 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 > The problem is that it causes more headaches then it solves. What if the class name conflict is a real one: 2 different classes that have actually the same name. By effectively silencing the fatal error, the code will have a strange hard-to-detect behavior. That's why there are include_path, require_once and include_once. If you actually have some fatal errors like these, it means there is something seriously wrong going on, and you should welcome such errors as they help debug and make your application more reliable. -Philippe

« previous php.pear.dev (#43497) next »