Re: cvs: pear-core /PEAR/Command Package.php
| From: | Helgi Þormar Þorbjörnsson | Date: | Sat, 29 Mar 2008 21:08:17 +0000 |
| Subject: | Re: cvs: pear-core /PEAR/Command Package.php | ||
| References: | 1 2 | Groups: | php.pear.cvs php.pear.core |
| Request: | Send a blank email to pear-core+get-7419@lists.php.net to get a copy of this message | ||
On Sat, Mar 29, 2008 at 5:38 PM, Greg Beaver <greg@chiaraquartet.net> wrote:
> Helgi Þormar Þorbjörnsson wrote:
> > dufuz Fri Mar 28 22:53:31 2008 UTC
> >
> > Modified files:
> > /pear-core/PEAR/Command Package.php
> > Log:
> > Bug #13525 pear package-validate is not showing warnings even if
> there are
> >
> >
>
> http://cvs.php.net/viewvc.cgi/pear-core/PEAR/Command/Package.php?r1=1.126&r2=1.127&diff_format=u
> > Index: pear-core/PEAR/Command/Package.php
> > diff -u pear-core/PEAR/Command/Package.php:1.126pear-core/PEAR/Command/Package.php:
> 1.127
> > --- pear-core/PEAR/Command/Package.php:1.126 Tue Jan 29 03:21:01 2008
> > +++ pear-core/PEAR/Command/Package.php Fri Mar 28 22:53:31 2008
> > @@ -18,7 +18,7 @@
> > * @author Greg Beaver <cellog@php.net>
> > * @copyright 1997-2008 The PHP Group
> > * @license http://www.php.net/license/3_0.txt PHP
> > License 3.0
> > - * @version CVS: $Id: Package.php,v 1.126 2008/01/29 03:21:01 cellog
> Exp $
> > + * @version CVS: $Id: Package.php,v 1.127 2008/03/28 22:53:31 dufuz
> Exp $
> > * @link http://pear.php.net/package/PEAR
> > * @since File available since Release 0.1
> > */
> > @@ -374,15 +374,12 @@
> > } else {
> > $valid = $info->validate(PEAR_VALIDATE_PACKAGING);
> > }
> > - $err = array();
> > - $warn = array();
> > - if (!$valid) {
> > - foreach ($info->getValidationWarnings() as $error) {
> > - if ($error['level'] == 'warning') {
> > - $warn[] = $error['message'];
> > - } else {
> > - $err[] = $error['message'];
> > - }
> > + $err = $warn = array();
> > + foreach ($info->getValidationWarnings() as $error) {
> > + if (!$valid) {
> > + $err[] = $error['message'];
> > + } else {
> > + $warn[] = $error['message'];
>
> This is incorrect - the patch removes warning/error distinction. What
> you want is:
>
> if ($errors = $info->getValidationWarnings()) {
> }
>
> and then the original foreach()
I can do that but all my tests showed that my approach worked just as well
because $valid is only false when there are errors in the validation so IMHO
it's just schematics you are talking about, actually what you want is to
only catch warnings and make everything else into an error instead of the
reverse what I did ... catch all errors and make everything else warnings.
afaik getErrors in ErrorStack always returns an array no matter what and
getValidationWarnings says it only turns arrays, rendering the if () you
want to add rather ineffective unless the docblock is wrong on the func, but
well your code, I'll commit it the way you want.
- Helgi