diff options
author | Aleksander Machniak <alec@alec.pl> | 2021-10-02 09:40:56 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2021-10-02 09:40:56 +0300 |
commit | 626332d42a6c4d12389b40ae57113e95f3b2ce56 (patch) | |
tree | 796258289b79893e0d8dc2f29633206bc4bacb1c /program | |
parent | e0e5626802f201b756b61928c13217abc942940a (diff) |
Don't use is_resource() where not needed
Diffstat (limited to 'program')
-rw-r--r-- | program/lib/Roundcube/db/oracle.php | 7 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_imap_generic.php | 6 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_ldap.php | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/program/lib/Roundcube/db/oracle.php b/program/lib/Roundcube/db/oracle.php index a7e8a0883..038a4a52d 100644 --- a/program/lib/Roundcube/db/oracle.php +++ b/program/lib/Roundcube/db/oracle.php @@ -198,13 +198,14 @@ class rcube_db_oracle extends rcube_db * Helper method to handle DB errors. * This by default logs the error but could be overridden by a driver implementation * - * @param string Query that triggered the error + * @param string Query that triggered the error + * @param resource Query result * - * @return mixed Result to be stored and returned + * @return bool Result to be stored and returned */ protected function handle_error($query, $result = null) { - $error = oci_error(is_resource($result) ? $result : $this->dbh); + $error = oci_error($result ?: $this->dbh); // @TODO: Find error codes for key errors if (empty($this->options['ignore_key_errors']) || !in_array($error['code'], ['23000', '23505'])) { diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index 8755f1f9a..d7a7df830 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -413,7 +413,7 @@ class rcube_imap_generic */ protected function eof() { - if (!is_resource($this->fp)) { + if (!$this->fp) { return true; } @@ -562,7 +562,7 @@ class rcube_imap_generic * @param string $pass Password * @param string $type Authentication type (PLAIN/CRAM-MD5/DIGEST-MD5) * - * @return resource Connection resource on success, error code on error + * @return resource|int Connection resource on success, error code on error */ protected function authenticate($user, $pass, $type = 'PLAIN') { @@ -817,7 +817,7 @@ class rcube_imap_generic * @param string $user Username * @param string $pass Password * - * @return resource Connection resource on success, error code on error + * @return resource|int Connection resource on success, error code on error */ protected function login($user, $password) { diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index 2b136f0b1..0b4fc6112 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -488,7 +488,7 @@ class rcube_ldap extends rcube_addressbook } // end foreach hosts - if (!is_resource($this->ldap->conn)) { + if (empty($this->ldap->conn)) { rcube::raise_error([ 'code' => 100, 'type' => 'ldap', 'file' => __FILE__, 'line' => __LINE__, |