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

Bug #18486 REST/10.php does not check error condition
Submitted: 2011-04-27 23:52 UTC
From: bensmith Assigned: dufuz
Status: Closed Package: PEAR (version 1.9.2)
PHP Version: 5.3.6 OS: Fedora 13
Roadmaps: (Not assigned)    
Subscription  


 [2011-04-27 23:52 UTC] bensmith (Ben Smith)
Description: ------------ When trying to install Horde using "pear install", I sometimes get this error: PHP Fatal error: Cannot use object of type PEAR_Error as array in /usr/share/pear/PEAR/REST/10.php on line 295 Here is the code causing the problem: 293 $allinfo = $this->_rest->retrieveData($base . 'r/' . $packageLower . 294 '/allreleases.xml', false, false, $channel); 295 if (!is_array($allinfo['r']) || !isset($allinfo['r'][0])) { 296 $allinfo['r'] = array($allinfo['r']); 297 } It looks like the problem is that retrieveData's output needs to be checked for an error condition. Test script: --------------- I was using the pear tool like this: pear install horde/Kronolith ~20 minutes later, I ran the same command, and didn't get the error. This appears to be an intermittent problem, maybe (?) caused by not being able to connect to horde.pear.org. Expected result: ---------------- I would expect a more informative error message. This error message is confusing for the user because it does not indicate that there is, probably, a problem at the REST protocol level. Actual result: -------------- PHP Fatal error: Cannot use object of type PEAR_Error as array in /usr/share/pear/PEAR/REST/10.php on line 295

Comments

 [2011-05-29 18:27 UTC] doconnor (Daniel O'Connor)
-Assigned To: +Assigned To: dufuz
 [2011-06-01 09:56 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Summary: REST/10.php:295 does not check error condition +Summary: REST/10.php does not check error condition -Status: Assigned +Status: Closed
This bug has been fixed in SVN. 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. I couldn't reproduce the exact problem but that specific case of retrieveData was missing an error check in any case and is now handled more gracefully.