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

Bug #6075 unnecessary validation of maintainers can break PEAR_PFM
Submitted: 2005-11-25 21:53 UTC
From: farell Assigned: cellog
Status: Closed Package: PEAR (version 1.4.6)
PHP Version: 4.4.0 OS: Windows XP
Roadmaps: (Not assigned)    
Subscription  


 [2005-11-25 21:53 UTC] farell
Description: ------------ I've recently upgrade my PEAR version from 1.3.6 to 1.4.4, and now today to 1.4.5, and begun to play with PFM 1.6.0a4 I've found some problems: 1st one is related to convertion to package.xml v1 with exportCompatiblePackageFile1() function. I've used a script (see below) that generate a v2 package2.xml and also a v1 package.xml With one leader (as only active maintainer), i lost the maintainers list during convertion, and got an error message with $pkgV1->debugPackageFile() (see actual results). Test script: --------------- <?php function varDump($var) { echo '<pre>'; print_r($var); echo '</pre>'; } //require_once 'PEAR/Packager.php'; require_once 'PEAR/PackageFileManager2.php'; PEAR::setErrorHandling(PEAR_ERROR_DIE); // Package name and license used $package = 'HTML_QuickForm_advmultiselect'; $license = 'PHP License 3.0'; // Full description of the package $description = <<<DESCR The HTML_QuickForm_advmultiselect package adds an element to the HTML_QuickForm package that is two select boxes next to each other emulating a multi-select. DESCR; // Summary of description of the package $summary = 'Element for HTML_QuickForm that emulate a multi-select.'; // base of install directory $baseinstalldir = 'HTML/QuickForm'; // Configuration of PEAR::PackageFileManager $optionsUpdate = array( 'packagedirectory' => '.', 'filelistgenerator' => 'cvs', 'baseinstalldir' => $baseinstalldir, 'changelogoldtonew' => false, 'simpleoutput' => false, 'ignore' => array('package.xml', basename(__FILE__)) ); $pkg = new PEAR_PackageFileManager2(); $pkg->setOptions($optionsUpdate); $pkg->setPackage($package); $pkg->setChannel('pear.php.net'); $pkg->setPearinstallerDep('1.4.3'); $pkg->setSummary($summary); $pkg->setDescription($description); $pkg->setLicense($license); $pkg->setPackageType('php'); $pkg->addRelease(); $pkg->setAPIVersion('1.0.0'); $pkg->setAPIStability('stable'); $pkg->setReleaseVersion('1.1.0'); $pkg->setReleaseStability('stable'); $pkg->setNotes('a first note'); $pkg->addMaintainer('lead', 'farell', 'Laurent Laville', 'pear@laurent-laville.org'); $xml = $pkg->_packageInfo; varDump($xml); // (see actual result dump1) $pkgV1 = &$pkg->exportCompatiblePackageFile1(); $xml = $pkgV1->_packageXml; varDump($xml); // (see actual result dump2) $pkgV1->debugPackageFile(); ?> Expected result: ---------------- maintainer list in package v1 not empty and $pkgV1->debugPackageFile() gave no more error message. Actual result: -------------- // related to package v2 dump1 Array ( [name] => HTML_QuickForm_advmultiselect ... [lead] => Array ( [name] => Laurent Laville [user] => farell [email] => pear@laurent-laville.org [active] => yes ) ... ) // related to package v1 dump2 Array ( [package] => HTML_QuickForm_advmultiselect ... [maintainers] => Array ( ) ) PEAR_PackageFileManager Error: Add maintainers to a package before generating the package.xml

Comments

 [2006-01-08 21:59 UTC] farell
As PFM2 use share code from PEAR core, i request your agreement and also because i'm not maintainer of PEAR package. So to solve this problem, here is what i've done on my local copy : removed lines if (!$this->_isValid && !$this->validate()) { return false; } of getMaintainers() method from PEAR\PackageFile\v2.php Laurent
 [2006-01-23 17:47 UTC] cellog
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.
 [2006-01-23 20:49 UTC] farell
I re-open this bug because i was too fast in my first analyse. We need to keep the same behaviour, and return 'false' when there is no maintainers defined. Actually we have such result array(1) { [0]=> array(2) { ["handle"]=> NULL ["role"]=> string(4) "lead" } } rather than just "false". I suggest to add after function getMaintainers($raw = false) those lines if (!isset($this->_packageInfo['lead'])) { return false; } just before the if ($raw) { Sorry ! Laurent
 [2006-01-28 17:36 UTC] cellog
please provide a patch, I can't quite tell what you mean by the last comment. Thanks P.S. TortoiseCVS has capability to make patches, if you don't have access to a unix box. ALso, if you have cvs in command line, just do cvs diff -u > bug6075.txt
 [2006-01-29 10:40 UTC] farell
Here is my cvs diff : Don't forget to see also my patch for bug#6576 Hope this time, my explains should be enough and you'll see what i means. Laurent Index: v2.php =================================================================== RCS file: /repository/pear-core/PEAR/PackageFile/v2.php,v retrieving revision 1.127 diff -r1.127 v2.php 124c124 < * - dependencies --- > * - dependencies 916a917,919 > if (!isset($this->_packageInfo['lead'])) { > return false; > } 1540c1543 < } --- > } 1558c1561 < } --- > } 1999c2002 < ?> --- > ?> \ No newline at end of file
 [2006-02-04 00:27 UTC] cellog
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.