@@ -38,7 +38,7 @@ public function add(Entry $entry)
38
38
$ con = $ this ->getConnectionResource ();
39
39
40
40
if (!@ldap_add ($ con , $ entry ->getDn (), $ entry ->getAttributes ())) {
41
- throw new LdapException (sprintf ('Could not add entry "%s": %s. ' , $ entry ->getDn (), ldap_error ($ con )));
41
+ throw new LdapException (sprintf ('Could not add entry "%s": %s. ' , $ entry ->getDn (), ldap_error ($ con )), ldap_errno ( $ con ) );
42
42
}
43
43
44
44
return $ this ;
@@ -52,7 +52,7 @@ public function update(Entry $entry)
52
52
$ con = $ this ->getConnectionResource ();
53
53
54
54
if (!@ldap_modify ($ con , $ entry ->getDn (), $ entry ->getAttributes ())) {
55
- throw new LdapException (sprintf ('Could not update entry "%s": %s. ' , $ entry ->getDn (), ldap_error ($ con )));
55
+ throw new LdapException (sprintf ('Could not update entry "%s": %s. ' , $ entry ->getDn (), ldap_error ($ con )), ldap_errno ( $ con ) );
56
56
}
57
57
}
58
58
10000
@@ -64,7 +64,7 @@ public function remove(Entry $entry)
64
64
$ con = $ this ->getConnectionResource ();
65
65
66
66
if (!@ldap_delete ($ con , $ entry ->getDn ())) {
67
- throw new LdapException (sprintf ('Could not remove entry "%s": %s. ' , $ entry ->getDn (), ldap_error ($ con )));
67
+ throw new LdapException (sprintf ('Could not remove entry "%s": %s. ' , $ entry ->getDn (), ldap_error ($ con )), ldap_errno ( $ con ) );
68
68
}
69
69
}
70
70
@@ -79,7 +79,7 @@ public function addAttributeValues(Entry $entry, string $attribute, array $value
79
79
$ con = $ this ->getConnectionResource ();
80
80
81
81
if (!@ldap_mod_add ($ con , $ entry ->getDn (), [$ attribute => $ values ])) {
82
- throw new LdapException (sprintf ('Could not add values to entry "%s", attribute %s: %s. ' , $ entry ->getDn (), $ attribute , ldap_error ($ con )));
82
+ throw new LdapException (sprintf ('Could not add values to entry "%s", attribute %s: %s. ' , $ entry ->getDn (), $ attribute , ldap_error ($ con )), ldap_errno ( $ con ) );
83
83
}
84
84
}
85
85
@@ -94,7 +94,7 @@ public function removeAttributeValues(Entry $entry, string $attribute, array $va
94
94
$ con = $ this ->getConnectionResource ();
95
95
96
96
if (!@ldap_mod_del ($ con , $ entry ->getDn (), [$ attribute => $ values ])) {
97
- throw new LdapException (sprintf ('Could not remove values from entry "%s", attribute %s: %s. ' , $ entry ->getDn (), $ attribute , ldap_error ($ con )));
97
+ throw new LdapException (sprintf ('Could not remove values from entry "%s", attribute %s: %s. ' , $ entry ->getDn (), $ attribute , ldap_error ($ con )), ldap_errno ( $ con ) );
98
98
}
99
99
}
100
100
@@ -106,7 +106,7 @@ public function rename(Entry $entry, string $newRdn, bool $removeOldRdn = true)
106
106
$ con = $ this ->getConnectionResource ();
107
107
108
108
if (!@ldap_rename ($ con , $ entry ->getDn (), $ newRdn , null , $ removeOldRdn )) {
109
- throw new LdapException (sprintf ('Could not rename entry "%s" to "%s": %s. ' , $ entry ->getDn (), $ newRdn , ldap_error ($ con )));
109
+ throw new LdapException (sprintf ('Could not rename entry "%s" to "%s": %s. ' , $ entry ->getDn (), $ newRdn , ldap_error ($ con )), ldap_errno ( $ con ) );
110
110
}
111
111
}
112
112
@@ -122,7 +122,7 @@ public function move(Entry $entry, string $newParent)
122
122
$ rdn = $ this ->parseRdnFromEntry ($ entry );
123
123
// deleteOldRdn does not matter here, since the Rdn will not be changing in the move.
124
124
if (!@ldap_rename ($ con , $ entry ->getDn (), $ rdn , $ newParent , true )) {
125
- throw new LdapException (sprintf ('Could not move entry "%s" to "%s": %s. ' , $ entry ->getDn (), $ newParent , ldap_error ($ con )));
125
+ throw new LdapException (sprintf ('Could not move entry "%s" to "%s": %s. ' , $ entry ->getDn (), $ newParent , ldap_error ($ con )), ldap_errno ( $ con ) );
126
126
}
127
127
}
128
128
@@ -152,7 +152,7 @@ public function applyOperations(string $dn, iterable $operations): void
152
152
}
153
153
154
154
if (!@ldap_modify_batch ($ this ->getConnectionResource (), $ dn , $ operationsMapped )) {
155
- throw new UpdateOperationException (sprintf ('Error executing UpdateOperation on "%s": "%s". ' , $ dn , ldap_error ($ this ->getConnectionResource ())));
155
+ throw new UpdateOperationException (sprintf ('Error executing UpdateOperation on "%s": "%s". ' , $ dn , ldap_error ($ this ->getConnectionResource ())), ldap_errno ( $ con ) );
156
156
}
157
157
}
158
158
0 commit comments