[phpldapadmin] [ phpldapadmin-Bugs-2022966 ] Errors when adding new attribute

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.ldap.davedap
Message-ID <[email protected]>
Bugs item #2022966, was opened at 2008-07-21 04:02
Message generated for change (Settings changed) made by wurley
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498546&aid=2022966&group_id=61828

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Jamie Thompson (mr_jrt)
Assigned to: Nobody/Anonymous (nobody)
Summary: Errors when adding new attribute

Initial Comment:
I was attempting to add an attribute to an entry when I got this:

Error
E_WARNING: array_search() [function.array-search]: Wrong datatype for second argument

error	You found a non-fatal phpLDAPadmin bug!
Error:	Array to string conversion (E_NOTICE)
File:	add_attr_form.php line 27, caller cmd.php
Versions:	PLA: 1.1.0.5, PHP: 5.2.6-2, SAPI: apache2handler
Web server:	Apache/2.2.9 (Debian) DAV/2 SVN/1.5.0 PHP/5.2.6-2 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g

error	You found a non-fatal phpLDAPadmin bug!
Error:	Array to string conversion (E_NOTICE)
File:	add_attr_form.php line 28, caller cmd.php
Versions:	PLA: 1.1.0.5, PHP: 5.2.6-2, SAPI: apache2handler
Web server:	Apache/2.2.9 (Debian) DAV/2 SVN/1.5.0 PHP/5.2.6-2 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g

error	You found a non-fatal phpLDAPadmin bug!
Error:	Array to string conversion (E_NOTICE)
File:	add_attr_form.php line 31, caller cmd.php
Versions:	PLA: 1.1.0.5, PHP: 5.2.6-2, SAPI: apache2handler
Web server:	Apache/2.2.9 (Debian) DAV/2 SVN/1.5.0 PHP/5.2.6-2 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g

File	/usr/share/phpldapadmin/lib/functions.php (154)
 	Function	error (a:4:{i:0;s:121:"E_WARNING: array_search() [<a href='function.array-search'>function.array-search</a>]: Wrong datatype for second argument";i:1;s:5:"error";i:2;b:1;i:3;b:1;})
File	()
 	Function	pla_error_handler (a:5:{i:0;i:2;i:1;s:110:"array_search() [<a href='function.array-search'>function.array-search</a>]: Wrong datatype for second argument";i:2;s:48:"/usr/share/phpldapadmin/htdocs/add_attr_form.php" ****...<omitted large dump>...****
File	/usr/share/phpldapadmin/htdocs/add_attr_form.php (35)
 	Function	array_search (a:2:{i:0;s:16:"extensibleObject";i:1;s:1:"A";})
File	/usr/share/phpldapadmin/htdocs/cmd.php (39)
 	Function	include (a:1:{i:0;s:48:"/usr/share/phpldapadmin/htdocs/add_attr_form.php";})

I get this on every entry when I try to add an attribute.

I've attached a sample entry from my tree.


----------------------------------------------------------------------

Comment By: Deon George (wurley)
Date: 2008-11-29 00:42

Message:
Fix added to CVS (in BRANCH-1_1_0)

htdocs/add_attr_form.php 1.16.2.3

----------------------------------------------------------------------

Comment By: Fabricio (fl_tgst)
Date: 2008-08-05 23:19

Message:
Logged In: YES 
user_id=1186738
Originator: NO

Got the same here and it works with: $dn=array();



----------------------------------------------------------------------

Comment By: Grzegorz Marszalek (graf0)
Date: 2008-08-02 07:10

Message:
Logged In: YES 
user_id=2163392
Originator: NO

Hello,

patch for debian & ubuntu (maybe others as well):

--- htdocs/add_attr_form.php	2008-08-01 02:56:30.000000000 +0200
+++ htdocs.patched/add_attr_form.php	2008-08-01 02:57:43.000000000 +0200
@@ -24,6 +24,7 @@
 printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s:
<b>%s</b></h3>',
 	_('Server'),$ldapserver->name,_('Distinguished
Name'),htmlspecialchars($entry['dn']['string']));
 
+$dn=array();
 $dn['attrs'] = $ldapserver->getDNAttrs($entry['dn']['string']);
 $dn['oclasses'] =
$ldapserver->getDNAttr($entry['dn']['string'],'objectClass');
 if (! is_array($dn['oclasses']))


----------------------------------------------------------------------

Comment By: Jimmy (staufj22)
Date: 2008-08-02 02:52

Message:
Logged In: YES 
user_id=784820
Originator: NO

I got the same error, after upgrading to Debian Lenny.
The quick hack I did to make it work is to make $dn an array...

$dn=array();



----------------------------------------------------------------------

Comment By: Jamie Thompson (mr_jrt)
Date: 2008-07-21 07:10

Message:
Logged In: YES 
user_id=303772
Originator: YES

I've put some debugging dumps in @ line 27 of add_attr_form.php, and I get
this:

> debug_dump( $entry );
gives:
> Array
> (
>     [dn] => Array
>         (
>             [string] => dc=.
>         )
> 
>     [rdn] => dc=.
> )



> debug_dump( $dn );
gives:
> dc=.

> debug_dump( $ldapserver->getDNAttrs($entry['dn']['string']) );
gives:
> Array
> (
>     [dn] => Array
>         (
>             [0] => dc=.
>         )
> 
>     [objectClass] => Array
>         (
>             [0] => dNSDomain2
>         )
> 
>     [dc] => Array
>         (
>             [0] => .
>         )
> 
> )

So, given that I know nothing of how phpldapadmin works, I gather that the
problem is that line 27's:
> $dn['attrs'] = ... 
...is going to blow up as it's a string ("dc=."), and not an array.
Likewise, the second error I get is on lines 28 & 31, which do much the
same: 
> $dn['oclasses'] = ...

$dn doesn't seem to be populated in this file, so I've no idea if it's
meant to be an array or a string, but that would seem to point towards the
problem.

Oh, and my versions are:
phpLDAPadmin = 1.1.0.5-3
Your LDAP server = OpenLDAP 2.4.7-6.2
Your web server = Apache 2.2.9-5
PHP = 5.2.6-2
Your operating system = Debian Testing ([email protected])

- Jamie

----------------------------------------------------------------------

Comment By: Jamie Thompson (mr_jrt)
Date: 2008-07-21 07:10

Message:
Logged In: YES 
user_id=303772
Originator: YES

I've put some debugging dumps in @ line 27 of add_attr_form.php, and I get
this:

> debug_dump( $entry );
gives:
> Array
> (
>     [dn] => Array
>         (
>             [string] => dc=.
>         )
> 
>     [rdn] => dc=.
> )



> debug_dump( $dn );
gives:
> dc=.

> debug_dump( $ldapserver->getDNAttrs($entry['dn']['string']) );
gives:
> Array
> (
>     [dn] => Array
>         (
>             [0] => dc=.
>         )
> 
>     [objectClass] => Array
>         (
>             [0] => dNSDomain2
>         )
> 
>     [dc] => Array
>         (
>             [0] => .
>         )
> 
> )

So, given that I know nothing of how phpldapadmin works, I gather that the
problem is that line 27's:
> $dn['attrs'] = ... 
...is going to blow up as it's a string ("dc=."), and not an array.
Likewise, the second error I get is on lines 28 & 31, which do much the
same: 
> $dn['oclasses'] = ...

$dn doesn't seem to be populated in this file, so I've no idea if it's
meant to be an array or a string, but that would seem to point towards the
problem.

Oh, and my versions are:
phpLDAPadmin = 1.1.0.5-3
Your LDAP server = OpenLDAP 2.4.7-6.2
Your web server = Apache 2.2.9-5
PHP = 5.2.6-2
Your operating system = Debian Testing ([email protected])

- Jamie

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498546&aid=2022966&group_id=61828

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
______________________________________
phpLDAPadmin development mailing list.
To unsbuscribe: https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel
http://phpldapadmin.sourceforge.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.