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

Bug #4003 importOptions() won't work until setOptions() is called
Submitted: 2005-03-30 08:31 UTC Modified: 2005-04-06 17:22 UTC
From: scott at crisscott dot com Assigned: cellog
Status: Closed Package: PEAR_PackageFileManager
PHP Version: Irrelevant OS: N/A
Roadmaps: (Not assigned)    
Subscription  


 [2005-03-30 08:31 UTC] scott at crisscott dot com
Description: ------------ Before you can import options, you need to call setOptions(). importOptions() calls _getExistingPackageXML() which checks for $this->_options['pearcommonclass']. That array element is set to false until you call setOptions(). Greg suggested passing an array as an optional argument that would then be passed to setOptions() inside of importOptions() but don't think that will solve the problem. setOptions() requires several options that you are trying to set with importOptions(). You could get around this by passing a bunch of garbage, but that sounds shady to me. Another solution is to have the pear common class default to PEAR_Common if it isn't set or to have a method for setting the pear common class other than setOptions(). Reproduce code: --------------- $pf = new PEAR_PackageFileManager(); $result = $pf->importOptions('/path/to/package.xml'); if (PEAR::isError($result)) { echo $result->getMessage(); } else { print_r($pf->getOptions()); } Expected result: ---------------- Array ( 'optionName' => value ... ) Actual result: -------------- Run $managerclass->setOptions() before any other methods

Comments

 [2005-04-06 17:22 UTC] cellog
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. Please try the CVS version and see if it fits the bill. I implemented the extra parameter to importOptions() with a bit of tweaking of setOptions().