note 103586 modified in function.ldap-get-values-len by danbrown
| From: | danbrown@php.net | Date: | Thu, 21 Apr 2011 16:04:13 +0000 |
| Subject: | note 103586 modified in function.ldap-get-values-len by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179052@lists.php.net to get a copy of this message | ||
I had a lot of issues with decoding errors using ldap_get_values_len() and found a of unanswered
calls for help on a lot of forums.
The error message is - Warning: ldap_get_values(): Cannot get the value(s) of attribute Decoding
error in xxx.php.
It appears that this error seems to cover a multitude sins including simple typos in the attribute
name.
After using PHP to list the attributes of a particular record I noticed that the attribute
userCertificate wasn't listed simply as userCertificate but userCertificate;binary instead. I
wrote this into my code and all was fixed.
So my code looks as follows.
<?php
if (!$val = @ldap_get_values_len($con, $entry, "$attribute;binary"))
die ('Error retrieving value (' . ldap_error($con) . ')');
?>
I hope this saves someone the pain I went through trawling Google for an answer.
--was--
I had a lot of issues with decoding errors using ldap_get_values_len() and found a of unanswered
calls for help on a lot of forums.
The error message is - Warning: ldap_get_values(): Cannot get the value(s) of attribute Decoding
error in xxx.php.
It appears that this error seems to cover a multitude sins including simple typos in the attribute
name.
After using PHP to list the attributes of a particular record I noticed that the attribute
userCertificate wasn't listed simply as userCertificate but userCertificate;binary instead. I
wrote this into my code and all was fixed.
So my code looks as follows.
if (!$val = @ldap_get_values_len($con, $entry, "$attribute;binary"))
die ('Error retrieving value (' . ldap_error($con) . ')');
I hope this saves someone the pain I went through trawling Google for an answer.
http://php.net/manual/en/function.ldap-get-values-len.php