cvs: pear-core /PEAR Validate.php

From: Date: Thu, 04 Nov 2004 00:06:35 +0000
Subject: cvs: pear-core /PEAR Validate.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-1228@lists.php.net to get a copy of this message
cellog Wed Nov 3 19:06:35 2004 EDT Modified files: /pear-core/PEAR Validate.php Log: fix inexplicably stupid regex in validateVersion(), plus error messages for certain conditions http://cvs.php.net/diff.php/pear-core/PEAR/Validate.php?r1=1.25&r2=1.26&ty=u Index: pear-core/PEAR/Validate.php diff -u pear-core/PEAR/Validate.php:1.25 pear-core/PEAR/Validate.php:1.26 --- pear-core/PEAR/Validate.php:1.25 Wed Nov 3 18:45:16 2004 +++ pear-core/PEAR/Validate.php Wed Nov 3 19:06:34 2004 @@ -16,7 +16,7 @@ // | Authors: Gregory Beaver <cellog@php.net> | // +----------------------------------------------------------------------+ // -// $Id: Validate.php,v 1.25 2004/11/03 23:45:16 cellog Exp $ +// $Id: Validate.php,v 1.26 2004/11/04 00:06:34 cellog Exp $ define('PEAR_VALIDATE_INSTALLING', 1); define('PEAR_VALIDATE_UNINSTALLING', 2); // this is not bit-mapped like the others define('PEAR_VALIDATE_NORMAL', 3); @@ -236,10 +236,13 @@ // version must be based upon state switch ($this->_packagexml->getState()) { case 'snapshot' : + return true; case 'devel' : if ($versioncomponents[0] == '0') { return true; } + $this->_addFailure('version', + 'packages with devel stability must be < version 1.0.0'); return false; break; case 'alpha' : @@ -299,9 +302,10 @@ return false; } if (!is_numeric($versioncomponents[2])) { - if (preg_match('/\d+(rc|a|alpha||b|beta|)\d*/i', + if (preg_match('/\d+(rc|a|alpha|b|beta)\d*/i', $versioncomponents[2])) { - $this->_addFailure('version', 'RC/beta/alpha cannot be stable'); + $this->_addFailure('version', 'version "' . $version . '" or any ' . + 'RC/beta/alpha version cannot be stable'); return false; } }

« previous php.pear.core (#1228) next »