Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.15

Bug #8622 PFM2 - wrong php exclude version is not detected
Submitted: 2006-09-03 08:45 UTC
From: farell Assigned: cellog
Status: Closed Package: PEAR (version 1.4.11)
PHP Version: 4.4.2 OS: windows xp
Roadmaps: (Not assigned)    
Subscription  


 [2006-09-03 08:45 UTC] farell (Laurent Laville)
Description: ------------ I noticed this bug too late to be include with PEAR 1.4.11 Now i've still in mind, i share you what i've found and patch to fix it. With a PEAR_PackageFileManager2 script, when you set PHP versions dependencies with a bad exclude option (parameter #3, must be an array), you got NO ERROR, and package xml is built (but it's not valid). See script below To fix it, add in file "PEAR\PackageFile\v2\Validator.php", private method _validatePhpDep(), after min and max checks lines: <pre> if (isset($dep['exclude'])) { if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?$/', $dep['exclude'])) { $this->_invalidVersion($type . '<exclude>', $dep['exclude']); } } </pre> Laurent Laville Test script: --------------- <?php require_once 'PEAR/PackageFileManager2.php'; $pkg = &PEAR_PackageFileManager2::importOptions($packagedir . DIRECTORY_SEPARATOR . 'package2.xml', $optionsUpdate); // notice error 'letter o' rather than 'number zero' $pkg->setPhpDep('4.2.0', '5.2.0', array('5.o.o')); $pkg->debugPackageFile(); ?> Expected result: ---------------- WARNING: warning: PHP dependency already exists, overwriting PEAR_PackageFileManager2 Error: Package validation failed: Error: Version type <<dependencies><required><php><exclude>> is not a valid version (5.o.o) Actual result: -------------- package xml 2.0 is built with : ... <dependencies> <required> <php> <min>4.2.0</min> <max>5.2.0</max> <exclude>5.o.o</exclude> </php> ...

Comments

 [2006-09-22 02:40 UTC] cellog (Greg Beaver)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. the patch does not take into account possible deps with double exclude like: <php> <min>4.3.0</min> <max>6.0.0</max> <exclude>4.3.10</exclude> <exclude>5.0.0</exclude> </php> otherwise it is good