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

Bug #5220 connect() returns in some situations no false
Submitted: 2005-08-27 15:51 UTC
From: dwlnetnl at gmail dot com Assigned: amir
Status: Closed Package: Net_SmartIRC
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2005-08-27 15:51 UTC] dwlnetnl at gmail dot com
Description: ------------ USING DEVELOPMENT VERSION: * $Id: SmartIRC.php,v 1.90 2005/07/01 20:12:25 meebey Exp $ * $Revision: 1.90 $ * $Date: 2005/07/01 20:12:25 $ * SMARTIRC_VERSION: 1.1.0-dev ($Revision: 1.90 $) When reconnecting is set, the connect() functions die()'s when it fails to connect to the requested server. This does correspond to the API documentation, but the connect() function gives a TRUE (boolean) back when it's connected. It has to return a void when respecting the API documentation. My eyes falls on the last if-else control structure, because if you look with an "executing eye" to the code, it is impossible that $result at that time could be FALSE. So with this conclusion, the control structure has no function. It must be replaced with a single "return true;". Here is the diff: 1039c1039 < die(); --- > return false; 1057,1061c1057 < if ($result !== false) { < return true; < } else { < return false; < } --- > return true;

Comments

 [2005-09-13 04:12 UTC] ci-dev at gmx dot de
As far as I read the code, it is possible for $result to be (bool)false at the end: If the current connect attempt fails, but auto-reconnect is enabled and there are still tries "left".
 [2008-02-15 16:32 UTC] amir (Amir Mohammad Saied)
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.