Skip to content

Commit 0be571b

Browse files
committed
Remove error suppression
Don't suppress errors emitted by ext/ldap functions
1 parent d9a953e commit 0be571b

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

src/LDAPi/Directory.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function add($dn, array $entry)
5050
{
5151
$this->checkBound();
5252

53-
if (!@ldap_add($this->link, $dn, $entry)) {
53+
if (!ldap_add($this->link, $dn, $entry)) {
5454
throw new WriteFailureException(ldap_error($this->link), ldap_errno($this->link));
5555
}
5656
}
@@ -65,7 +65,7 @@ public function bind($dn = null, $password = null)
6565
{
6666
$this->checkConnected();
6767

68-
if (!@ldap_bind($this->link, $dn, $password)) {
68+
if (!ldap_bind($this->link, $dn, $password)) {
6969
throw new BindFailureException(ldap_error($this->link), ldap_errno($this->link));
7070
}
7171

@@ -84,7 +84,7 @@ public function compare($dn, $attribute, $value)
8484
{
8585
$this->checkBound();
8686

87-
if (-1 === $result = @ldap_compare($this->link, $dn, $entry)) {
87+
if (-1 === $result = ldap_compare($this->link, $dn, $entry)) {
8888
throw new ReadFailureException(ldap_error($this->link), ldap_errno($this->link));
8989
}
9090

@@ -103,7 +103,7 @@ public function connect($host, $port = 389)
103103
throw new AlreadyAvailableException('An active connection to the directory is already available');
104104
}
105105

106-
if (!$this->link = @ldap_connect($host, $port)) {
106+
if (!$this->link = ldap_connect($host, $port)) {
107107
throw new ConnectFailureException(ldap_error($this->link), ldap_errno($this->link));
108108
}
109109
}
@@ -119,7 +119,7 @@ public function controlPagedResult($pageSize, $isCritical = false, $cookie = '')
119119
{
120120
$this->checkBound();
121121

122-
if (!@ldap_control_paged_result($this->link, $pageSize, $isCritical, $cookie)) {
122+
if (!ldap_control_paged_result($this->link, $pageSize, $isCritical, $cookie)) {
123123
throw new PaginationFailureException(ldap_error($this->link), ldap_errno($this->link));
124124
}
125125
}
@@ -133,7 +133,7 @@ public function delete($dn)
133133
{
134134
$this->checkBound();
135135

136-
if (!@ldap_delete($this->link, $dn)) {
136+
if (!ldap_delete($this->link, $dn)) {
137137
throw new WriteFailureException(ldap_error($this->link), ldap_errno($this->link));
138138
}
139139
}
@@ -148,7 +148,7 @@ public function getOption($opt)
148148
{
149149
$this->checkConnected();
150150

151-
if (!@ldap_get_option($this->link, $opt, $value)) {
151+
if (!ldap_get_option($this->link, $opt, $value)) {
152152
throw new OptionFailureException(ldap_error($this->link), ldap_errno($this->link));
153153
}
154154

@@ -171,7 +171,7 @@ public function listChildren($dn, $filter, array $attributes = null, $attrsOnly
171171
{
172172
$this->checkBound();
173173

174-
if (!$result = @ldap_list($this->link, $dn, $filter, (array)$attributes, (int)(bool)$attrsOnly, $sizeLimit, $timeLimit, $deRef)) {
174+
if (!$result = ldap_list($this->link, $dn, $filter, (array)$attributes, (int)(bool)$attrsOnly, $sizeLimit, $timeLimit, $deRef)) {
175175
throw new ReadFailureException(ldap_error($this->link), ldap_errno($this->link));
176176
}
177177

@@ -188,7 +188,7 @@ public function modAdd($dn, array $entry)
188188
{
189189
$this->checkBound();
190190

191-
if (!@ldap_mod_add($this->link, $dn, $entry)) {
191+
if (!ldap_mod_add($this->link, $dn, $entry)) {
192192
throw new WriteFailureException(ldap_error($this->link), ldap_errno($this->link));
193193
}
194194
}
@@ -203,7 +203,7 @@ public function modDel($dn, array $entry)
203203
{
204204
$this->checkBound();
205205

206-
if (!@ldap_mod_del($this->link, $dn, $entry)) {
206+
if (!ldap_mod_del($this->link, $dn, $entry)) {
207207
throw new WriteFailureException(ldap_error($this->link), ldap_errno($this->link));
208208
}
209209
}
@@ -218,7 +218,7 @@ public function modReplace($dn, array $entry)
218218
{
219219
$this->checkBound();
220220

221-
if (!@ldap_mod_replace($this->link, $dn, $entry)) {
221+
if (!ldap_mod_replace($this->link, $dn, $entry)) {
222222
throw new WriteFailureException(ldap_error($this->link), ldap_errno($this->link));
223223
}
224224
}
@@ -233,7 +233,7 @@ public function modify($dn, array $entry)
233233
{
234234
$this->checkBound();
235235

236-
if (!@ldap_modify($this->link, $dn, $entry)) {
236+
if (!ldap_modify($this->link, $dn, $entry)) {
237237
throw new WriteFailureException(ldap_error($this->link), ldap_errno($this->link));
238238
}
239239
}
@@ -254,7 +254,7 @@ public function read($dn, $filter, array $attributes = null, $attrsOnly = false,
254254
{
255255
$this->checkBound();
256256

257-
if (!$result = @ldap_read($this->link, $dn, $filter, (array)$attributes, (int)(bool)$attrsOnly, $sizeLimit, $timeLimit, $deRef)) {
257+
if (!$result = ldap_read($this->link, $dn, $filter, (array)$attributes, (int)(bool)$attrsOnly, $sizeLimit, $timeLimit, $deRef)) {
258258
throw new ReadFailureException(ldap_error($this->link), ldap_errno($this->link));
259259
}
260260

@@ -273,7 +273,7 @@ public function rename($dn, $newRDN, $newParent, $deleteOldRDN = true)
273273
{
274274
$this->checkBound();
275275

276-
if (!@ldap_rename($this->link, $dn, $newRDN, $newParent, $deleteOldRDN)) {
276+
if (!ldap_rename($this->link, $dn, $newRDN, $newParent, $deleteOldRDN)) {
277277
throw new WriteFailureException(ldap_error($this->link), ldap_errno($this->link));
278278
}
279279
}
@@ -293,7 +293,7 @@ public function saslBind($dn = null, $password = null, $saslMech = null, $saslRe
293293
{
294294
$this->checkConnected();
295295

296-
if (!@ldap_sasl_bind($this->link, $dn, $password, $saslMech, $saslRealm, $saslAuthcId, $saslAuthzId, $props)) {
296+
if (!ldap_sasl_bind($this->link, $dn, $password, $saslMech, $saslRealm, $saslAuthcId, $saslAuthzId, $props)) {
297297
throw new BindFailureException(ldap_error($this->link), ldap_errno($this->link));
298298
}
299299

@@ -316,7 +316,7 @@ public function search($dn, $filter, array $attributes = null, $attrsOnly = fals
316316
{
317317
$this->checkBound();
318318

319-
if (!$result = @ldap_search($this->link, $dn, $filter, (array)$attributes, (int)(bool)$attrsOnly, $sizeLimit, $timeLimit, $deRef)) {
319+
if (!$result = ldap_search($this->link, $dn, $filter, (array)$attributes, (int)(bool)$attrsOnly, $sizeLimit, $timeLimit, $deRef)) {
320320
throw new ReadFailureException(ldap_error($this->link), ldap_errno($this->link));
321321
}
322322

@@ -333,7 +333,7 @@ public function setOption($opt, $value)
333333
{
334334
$this->checkConnected();
335335

336-
if (!@ldap_set_option($this->link, $opt, $value)) {
336+
if (!ldap_set_option($this->link, $opt, $value)) {
337337
throw new OptionFailureException(ldap_error($this->link), ldap_errno($this->link));
338338
}
339339
}
@@ -347,7 +347,7 @@ public function setRebindProc(callable $callback)
347347
{
348348
$this->checkConnected();
349349

350-
if (!@ldap_set_rebind_proc($this->link, $callback)) {
350+
if (!ldap_set_rebind_proc($this->link, $callback)) {
351351
throw new OptionFailureException(ldap_error($this->link), ldap_errno($this->link));
352352
}
353353
}
@@ -364,7 +364,7 @@ public function startTLS()
364364
throw new AlreadyAvailableException('An active bound connection to the directory is already available');
365365
}
366366

367-
if (!@ldap_start_tls($this->link)) {
367+
if (!ldap_start_tls($this->link)) {
368368
throw new EncryptionFailureException(ldap_error($this->link), ldap_errno($this->link));
369369
}
370370
}
@@ -376,7 +376,7 @@ public function unbind()
376376
{
377377
$this->checkBound();
378378

379-
@ldap_unbind($this->link);
379+
ldap_unbind($this->link);
380380

381381
$this->link = null;
382382
$this->bound = false;

src/LDAPi/Entry.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct($link, $entry)
3030
*/
3131
public function nextEntry()
3232
{
33-
if (!$entry = @ldap_next_entry($this->link, $this->entry)) {
33+
if (!$entry = ldap_next_entry($this->link, $this->entry)) {
3434
if (0 !== $errNo = ldap_errno($this->link)) {
3535
throw new EntryRetrievalFailureException(ldap_error($this->link), $errNo);
3636
}
@@ -47,7 +47,7 @@ public function nextEntry()
4747
*/
4848
public function getValues($attribute)
4949
{
50-
if (!$values = @ldap_get_values($this->link, $this->entry, $attribute)) {
50+
if (!$values = ldap_get_values($this->link, $this->entry, $attribute)) {
5151
throw new ValueRetrievalFailureException(ldap_error($this->link), ldap_errno($this->link));
5252
}
5353

@@ -60,7 +60,7 @@ public function getValues($attribute)
6060
*/
6161
public function getAttributes()
6262
{
63-
if (!$attributes = @ldap_get_attributes($this->link, $this->entry)) {
63+
if (!$attributes = ldap_get_attributes($this->link, $this->entry)) {
6464
throw new ValueRetrievalFailureException(ldap_error($this->link), ldap_errno($this->link));
6565
}
6666

@@ -73,7 +73,7 @@ public function getAttributes()
7373
*/
7474
public function getDN()
7575
{
76-
if (!$dn = @ldap_get_dn($this->link, $this->entry)) {
76+
if (!$dn = ldap_get_dn($this->link, $this->entry)) {
7777
throw new ValueRetrievalFailureException(ldap_error($this->link), ldap_errno($this->link));
7878
}
7979

src/LDAPi/Reference.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct($link, $reference)
3131
*/
3232
public function nextReference()
3333
{
34-
if (!$reference = @ldap_next_reference($this->link, $this->reference)) {
34+
if (!$reference = ldap_next_reference($this->link, $this->reference)) {
3535
if (0 !== $errNo = ldap_errno($this->link)) {
3636
throw new ReferenceRetrievalFailureException(ldap_error($this->link), $errNo);
3737
}
@@ -48,7 +48,7 @@ public function nextReference()
4848
*/
4949
public function parse()
5050
{
51-
if (!@ldap_parse_reference($this->link, $this->reference, $referrals)) {
51+
if (!ldap_parse_reference($this->link, $this->reference, $referrals)) {
5252
throw new ValueRetrievalFailureException(ldap_error($this->link), ldap_errno($this->link));
5353
}
5454

src/LDAPi/ResultSet.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct($link, $result)
2626

2727
public function __destruct()
2828
{
29-
@ldap_free_result($this->result);
29+
ldap_free_result($this->result);
3030
}
3131

3232
/**
@@ -36,7 +36,7 @@ public function __destruct()
3636
*/
3737
public function controlPagedResult(&$estimated = null)
3838
{
39-
if (!@ldap_control_paged_result_response($this->link, $this->result, $cookie, $estimated)) {
39+
if (!ldap_control_paged_result_response($this->link, $this->result, $cookie, $estimated)) {
4040
throw new PaginationFailureException(ldap_error($this->link), ldap_errno($this->link));
4141
}
4242

@@ -49,7 +49,7 @@ public function controlPagedResult(&$estimated = null)
4949
*/
5050
public function entryCount()
5151
{
52-
if (!$result = @ldap_count_entries($this->link, $this->result)) {
52+
if (!$result = ldap_count_entries($this->link, $this->result)) {
5353
throw new EntryCountRetrievalFailureException(ldap_error($this->link), ldap_errno($this->link));
5454
}
5555

@@ -62,7 +62,7 @@ public function entryCount()
6262
*/
6363
public function firstEntry()
6464
{
65-
if (!$entry = @ldap_first_entry($this->link, $this->result)) {
65+
if (!$entry = ldap_first_entry($this->link, $this->result)) {
6666
if (0 !== $errNo = ldap_errno($this->link)) {
6767
throw new EntryRetrievalFailureException(ldap_error($this->link), $errNo);
6868
}
@@ -79,7 +79,7 @@ public function firstEntry()
7979
*/
8080
public function firstReference()
8181
{
82-
if (!$reference = @ldap_first_reference($this->link, $this->result)) {
82+
if (!$reference = ldap_first_reference($this->link, $this->result)) {
8383
if (0 !== $errNo = ldap_errno($this->link)) {
8484
throw new ReferenceRetrievalFailureException(ldap_error($this->link), $errNo);
8585
}
@@ -96,7 +96,7 @@ public function firstReference()
9696
*/
9797
public function parse()
9898
{
99-
if (!@ldap_parse_result($this->link, $this->result, $errCode, $matchedDN, $errMsg, $referrals)) {
99+
if (!ldap_parse_result($this->link, $this->result, $errCode, $matchedDN, $errMsg, $referrals)) {
100100
throw new InformationRetrievalFailureException(ldap_error($this->link), ldap_errno($this->link));
101101
}
102102

@@ -114,7 +114,7 @@ public function parse()
114114
*/
115115
public function getEntries()
116116
{
117-
if (!$entries = @ldap_get_entries($this->link, $this->result)) {
117+
if (!$entries = ldap_get_entries($this->link, $this->result)) {
118118
throw new ValueRetrievalFailureException(ldap_error($this->link), ldap_errno($this->link));
119119
}
120120

0 commit comments

Comments
 (0)