note 46743 added to function.ldap-add
| From: | amcnabb at osu1 dot php dot net | Date: | Thu, 21 Oct 2004 21:37:29 +0000 |
| Subject: | note 46743 added to function.ldap-add | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78912@lists.php.net to get a copy of this message | ||
Be careful with types. PHP switches automatically between strings and numbers, but LDAP
doesn't, and PHP will send whatever is most convenient for PHP, not LDAP, unless you specify a
type.
If you inadvertently send a number as a string, you will get an error: "ldap_add(): Add:
Invalid syntax in [filename] on line LINENUM."
Observe this example which makes an array to send to LDAP to create a POSIX group. Note that
$new_groupid, which is technically a string, must be typecast with (int).
$new_ldap_group['cn'] = $groupname;
$new_ldap_group['objectclass'][0] = 'posixgroup';
$new_ldap_group['objectclass'][1] = 'top';
$new_ldap_group['gidnumber'] = (int) $new_groupid;
----
Manual Page -- http://www.php.net/manual/en/function.ldap-add.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46743
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46743&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46743&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46743&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46743&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46743&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46743&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46743&report=yes
Search -- http://master.php.net/manage/user-notes.php