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

Bug #5243 importOptions() won't work with 2nd arg filled
Submitted: 2005-08-30 16:04 UTC
From: farell Assigned: cellog
Status: Closed Package: PEAR_PackageFileManager
PHP Version: 4.3.10 OS: Windows XP SP2
Roadmaps: (Not assigned)    
Subscription  


 [2005-08-30 16:04 UTC] farell
Description: ------------ abbrev: PFM = PEAR_PackageFileManager This problem should occured on both versions: PFM 1.5.2 and 1.6.0a2 because source code of importOptions() are same. I'm expected to use importOptions() to retrieve existing options package and merge it with content of the 2nd arg. I think the setOptions() call (line 576) on importOptions() method is in wrong place . http://cvs.php.net/co.php/pear/PEAR_PackageFileManager/PackageFileManager.php?r=1.46#573 It should be after line 592. Laurent. Test script: --------------- <?php require_once 'PEAR/PackageFileManager.php'; $release['version'] = '1.0.0'; $release['state'] = 'stable'; $release['notes'] = 'about changes ...'; $package = 'HTML_QuickForm_advmultiselect'; $license = 'PHP License 3.0'; $description = 'a long desc ...'; $summary = 'Element for HTML_QuickForm that emulate a multi-select.'; $baseinstalldir = 'HTML/QuickForm'; $optionsUpdate = array( 'version' => $release['version'], 'state' => $release['state'], 'notes' => $release['notes'], 'packagedirectory' => '.', 'filelistgenerator' => 'cvs', 'baseinstalldir' => $baseinstalldir ); $optionsCreate = array( 'package' => $package, 'summary' => $summary, 'description' => $description, 'license' => $license ); $packagefile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package.xml'; $pkg = new PEAR_PackageFileManager(); $packagefileExists = file_exists($packagefile); if ($packagefileExists) { $pkg->importOptions($packagefile, $optionsUpdate); } else { $pkg->setOptions($optionsCreate); } echo '<pre>' . print_r($pkg->_options) . '</pre>'; ?> Expected result: ---------------- Array ( [packagefile] => package.xml [doctype] => http://pear.php.net/dtd/package-1.0 [filelistgenerator] => Cvs [license] => PHP License 3.0 ... [version] => 1.0.0 [state] => stable [date] => 2005-08-30 // build date [notes] => about changes ... ... ) Actual result: -------------- Array ( [packagefile] => package.xml [doctype] => http://pear.php.net/dtd/package-1.0 [filelistgenerator] => Cvs [license] => PHP License 3.0 ... [version] => 0.5.1 [state] => beta [date] => 2005-08-05 [notes] => note of release 0.5.1 ... )

Comments

 [2005-10-19 05:25 UTC] cellog
think you can do this one Laurent?
 [2005-10-25 02:30 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. too slow