core icon indicating copy to clipboard operation
core copied to clipboard

php invalid argument supplied error in ldap module

Open frankuit opened this issue 12 years ago • 9 comments

After upgrading from 6.0.4 to 7 yesterday, i keep getting the following error in the syslog (owncloud logs there) i am using Novell EDIR ldap for my user backend. Debian wheezy 64 bit server, with apache2, php amd mysql server.(all latest debian patches) Everything seems to be working, no problems detected, but maybe it means something.

Jul 24 10:23:10 owncloud ownCloud[32459]: {PHP} Invalid argument supplied for foreach() at /var/www/owncloud/apps/user_ldap/lib/access.php#201 Jul 24 10:23:44 owncloud ownCloud[33191]: {PHP} Invalid argument supplied for foreach() at /var/www/owncloud/apps/user_ldap/lib/access.php#201 Jul 24 10:23:51 owncloud ownCloud[32459]: {PHP} Invalid argument supplied for foreach() at /var/www/owncloud/apps/user_ldap/lib/access.php#201

frankuit avatar Jul 24 '14 08:07 frankuit

@blizzz

DeepDiver1975 avatar Jul 24 '14 08:07 DeepDiver1975

tagging this for 7.0.1

DeepDiver1975 avatar Jul 24 '14 08:07 DeepDiver1975

same here using Windows AD for user backend

prislea avatar Jul 25 '14 15:07 prislea

the same, error present after upgrade to OC 7.

4lfr3d7115 avatar Jul 26 '14 05:07 4lfr3d7115

Could you test whether this patch solves the issue for you?

diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 23ba425..9fc646c 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -192,7 +192,7 @@ class Access extends LDAPUtility implements user\IUserTools {
         */
        public function getDomainDNFromDN($dn) {
                $allParts = $this->ldap->explodeDN($dn, 0);
-               if($allParts === false) {
+               if(!is_array($allParts) || empty($allParts)) {
                        //not a valid DN
                        return '';
                }

blizzz avatar Aug 06 '14 15:08 blizzz

:+1: OC Version: 7.0.1 the patch works for me.

xtruthx avatar Aug 06 '14 23:08 xtruthx

OC Version: 7.0.1 Fixed. OK

4lfr3d7115 avatar Aug 07 '14 00:08 4lfr3d7115

Thanks guys, I put it to a PR.

blizzz avatar Aug 07 '14 08:08 blizzz

FYI, I looked more inside it, because my assumption why this happens did not confirm. Now i found the real (stupid) cause, PR follows, I will kindly ask you to test again in that PR.

blizzz avatar Aug 07 '14 15:08 blizzz