summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2007-07-13 02:00:39 +0000
committerJani Taskinen <jani@php.net>2007-07-13 02:00:39 +0000
commit3dff7a7dba9f2ae20854586836a59c7c37b0944a (patch)
tree142833b8143c97f170f1ad81f6120184f02f1448
parent95f8148f1862196d7cc3eb186e44619da3f29cbb (diff)
downloadphp-git-3dff7a7dba9f2ae20854586836a59c7c37b0944a.tar.gz
MFH: - Make sure people call ldap_first_attribute() before ldap_next_attribute()
-rw-r--r--ext/ldap/ldap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 77a44dd8c8..4fb5febe1c 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1165,6 +1165,11 @@ PHP_FUNCTION(ldap_next_attribute)
ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link);
ZEND_FETCH_RESOURCE(resultentry, ldap_resultentry *, result_entry, -1, "ldap result entry", le_result_entry);
+ if (resultentry->ber == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "called before calling ldap_first_attribute() or no attributes found in result entry");
+ RETURN_FALSE;
+ }
+
if ((attribute = ldap_next_attribute(ld->link, resultentry->data, resultentry->ber)) == NULL) {
#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10 || WINDOWS
if (resultentry->ber != NULL) {