Home » PEAR » PEAR_PackageFileManager » Bug #4003
importOptions() won't work until setOptions() is called
Details
| Submitted | 2005-03-30 14:31 UTC |
|---|---|
| From | scott at crisscott dot com |
| Assigned | cellog |
| Status | Closed |
| Package | PEAR_PackageFileManager |
| PHP Version | Irrelevant |
| OS | N/A |
| Roadmaps | (Not assigned) |
Comments
[2005-03-30 14: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