cvs: pear-core(PEAR_1_4) / package-PEAR.xml package2.xml /PEAR Validate.php

From: Date: Thu, 08 Jun 2006 01:21:54 +0000
Subject: cvs: pear-core(PEAR_1_4) / package-PEAR.xml package2.xml /PEAR Validate.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-4777@lists.php.net to get a copy of this message
pajoye Thu Jun 8 01:21:54 2006 UTC Modified files: (Branch: PEAR_1_4) /pear-core package2.xml package-PEAR.xml /pear-core/PEAR Validate.php Log: - #7640, validate the date field format (simplify the method too) http://cvs.php.net/viewcvs.cgi/pear-core/package2.xml?r1=1.246.2.10&r2=1.246.2.11&diff_format=u Index: pear-core/package2.xml diff -u pear-core/package2.xml:1.246.2.10 pear-core/package2.xml:1.246.2.11 --- pear-core/package2.xml:1.246.2.10 Thu Jun 8 00:13:28 2006 +++ pear-core/package2.xml Thu Jun 8 01:21:53 2006 @@ -90,6 +90,7 @@ <notes> bugfix release * fix Bug #7579: cannot convert package 1.0 to 2.0 with PFM 1.6.0 + * fix Bug #7640: Check invalid date format * fix Bug #7726: &lt;uri&gt; dependency is broken * fix Bug #7830: Warning in package-dependencies command when a dir is used * fix an issue in the better state detection http://cvs.php.net/viewcvs.cgi/pear-core/package-PEAR.xml?r1=1.352.2.10&r2=1.352.2.11&diff_format=u Index: pear-core/package-PEAR.xml diff -u pear-core/package-PEAR.xml:1.352.2.10 pear-core/package-PEAR.xml:1.352.2.11 --- pear-core/package-PEAR.xml:1.352.2.10 Thu Jun 8 00:13:28 2006 +++ pear-core/package-PEAR.xml Thu Jun 8 01:21:53 2006 @@ -85,6 +85,7 @@ <notes> bugfix release * fix Bug #7579: cannot convert package 1.0 to 2.0 with PFM 1.6.0 + * fix Bug #7640: Check invalid date format * fix Bug #7726: &lt;uri&gt; dependency is broken * fix Bug #7830: Warning in package-dependencies command when a dir is used * fix an issue in the better state detection http://cvs.php.net/viewcvs.cgi/pear-core/PEAR/Validate.php?r1=1.46&r2=1.46.2.1&diff_format=u Index: pear-core/PEAR/Validate.php diff -u pear-core/PEAR/Validate.php:1.46 pear-core/PEAR/Validate.php:1.46.2.1 --- pear-core/PEAR/Validate.php:1.46 Mon Jan 23 17:16:35 2006 +++ pear-core/PEAR/Validate.php Thu Jun 8 01:21:54 2006 @@ -15,7 +15,7 @@ * @author Greg Beaver <cellog@php.net> * @copyright 1997-2006 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Validate.php,v 1.46 2006/01/23 17:16:35 cellog Exp $ + * @version CVS: $Id: Validate.php,v 1.46.2.1 2006/06/08 01:21:54 pajoye Exp $ * @link http://pear.php.net/package/PEAR * @since File available since Release 1.4.0a1 */ @@ -445,17 +445,16 @@ { if ($this->_state == PEAR_VALIDATE_NORMAL || $this->_state == PEAR_VALIDATE_PACKAGING) { - if (!preg_match('/\d\d\d\d\-\d\d\-\d\d/', - $this->_packagexml->getDate())) { - $this->_addFailure('date', 'invalid release date "' . - $this->_packagexml->getDate() . '"'); - return false; - } - if (strtotime($this->_packagexml->getDate()) == -1) { + if (!preg_match('/(\d\d\d\d)\-(\d\d)\-(\d\d)/', + $this->_packagexml->getDate(), $res) || + count($res) < 4 + || !checkdate($res[2], $res[3], $res[1]) + ) { $this->_addFailure('date', 'invalid release date "' . $this->_packagexml->getDate() . '"'); return false; } + if ($this->_state == PEAR_VALIDATE_PACKAGING && $this->_packagexml->getDate() != date('Y-m-d')) { $this->_addWarning('date', 'Release Date "' . @@ -628,4 +627,4 @@ return true; } } -?> \ No newline at end of file +?>

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