PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_SmartIRC » Bug #5220

connect() returns in some situations no false

Details

Submitted2005-08-27 15:51 UTC
Fromdwlnetnl at gmail dot com
Assignedamir
StatusClosed
PackageNet_SmartIRC
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[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;

[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".