patch for Auth/imap.php

Gaudenz Steinlin gaudenz.steinlin@id.unibe.ch
Sat, 07 Oct 2000 01:51:52 +0200


I was using Auth_imap and ran into problems, because the type of an imap
stream is not resource (is_resource($imap) retruns false even if you logged
in correct). I think this could be a php bug.
I made a patch wich solves this problem:
steinlin@happystone:~/horde/lib/Auth > cvs diff imap.php
Index: imap.php
===================================================================
RCS file: /cvs/horde/horde/lib/Auth/imap.php,v
retrieving revision 1.2
diff -u -r1.2 imap.php
--- imap.php    2000/09/26 22:45:53     1.2
+++ imap.php    2000/10/06 23:44:17
@@ -23,7 +23,7 @@
      */
     function Auth_imap($params = array())
     {
-        setParams($params);
+        $this->setParams($params);
     }
@@ -50,7 +50,7 @@
             else
                 $params['dsn'] .= ':143}';
-            if (isseet($params['folder']))
+            if (isset($params['folder']))
                 $params['dsn'] .= $params['folder'];
         }
         $this->params = $params;
@@ -71,12 +71,11 @@
         }
         $imap = @imap_open($this->params['dsn'], $userID, $pass,
OP_HALFOPEN);
-        $auth_status = is_resource($imap);
-        imap_close($imap);
-        if ($auth_status) {
+        if ($imap) {
             Auth::setAuth($userID);
+           imap_close($imap);
         }
-        return $auth_status;
+        return $imap;
     }
     /**
- Gaudenz

Resent-Date: Sat, 07 Oct 2000 16:40:27 +00200 (CEST)
Resent-From: gaudenz.steinlin@id.unibe.ch
Resent-To: dev@lists.horde.org
Resent-Message-ID: <970929627.39df35db21f75@happystone.unibe.ch>

I was using Auth_imap and ran into problems, because the type of an imap
stream is not resource (is_resource($imap) retruns false even if you logged
in correct). I think this could be a php bug.
I made a patch wich solves this problem:
steinlin@happystone:~/horde/lib/Auth > cvs diff imap.php
Index: imap.php
===================================================================
RCS file: /cvs/horde/horde/lib/Auth/imap.php,v
retrieving revision 1.2
diff -u -r1.2 imap.php
--- imap.php    2000/09/26 22:45:53     1.2
+++ imap.php    2000/10/06 23:44:17
@@ -23,7 +23,7 @@
      */
     function Auth_imap($params = array())
     {
-        setParams($params);
+        $this->setParams($params);
     }


@@ -50,7 +50,7 @@
             else
                 $params['dsn'] .= ':143}';

-            if (isseet($params['folder']))
+            if (isset($params['folder']))
                 $params['dsn'] .= $params['folder'];
         }
         $this->params = $params;
@@ -71,12 +71,11 @@
         }

         $imap = @imap_open($this->params['dsn'], $userID, $pass,
OP_HALFOPEN);
-        $auth_status = is_resource($imap);
-        imap_close($imap);
-        if ($auth_status) {
+        if ($imap) {
             Auth::setAuth($userID);
+           imap_close($imap);
         }
-        return $auth_status;
+        return $imap;
     }

     /**

- Gaudenz