8000 fix(ldap): pagination for PHP 7.4 & 8.0 · Nek-/symfony@02f4ffd · GitHub
[go: up one dir, main page]

Skip to content

Commit 02f4ffd

Browse files
committed
fix(ldap): pagination for PHP 7.4 & 8.0
After PR symfony#38392 there is a little issue in the Symfony code base that occurs only for PHP 7.4 and PHP 8.0. This is related to issue symfony#38874
1 parent 2fb61a4 commit 02f4ffd

File tree

1 file changed

+10
-4
lines changed
  • src/Symfony/Component/Ldap/Adapter/ExtLdap

1 file changed

+10
-4
lines changed

src/Symfony/Component/Ldap/Adapter/ExtLdap/Query.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ public function getResources(): array
174174
private function resetPagination()
175175
{
176176
$con = $this->connection->getResource();
177-
$this->controlPagedResultResponse($con, 0, '');
178-
$this->serverctrls = [];
177+
$this->controlPagedResultResponse($con, null, '');
179178

180179
// This is a workaround for a bit of a bug in the above invocation
181180
// of ldap_control_paged_result. Instead of indicating to extldap that
@@ -226,16 +225,23 @@ private function controlPagedResult($con, int $pageSize, string $cookie): bool
226225
/**
227226
* Retrieve LDAP pagination cookie.
228227
*
229-
* @param resource $con
230-
* @param resource $result
228+
* @param resource $con
229+
* @param resource|null $result
231230
*/
232231
private function controlPagedResultResponse($con, $result, string $cookie = ''): string
233232
{
233+
$this->serverctrls = [];
234+
234235
if (\PHP_VERSION_ID < 70300) {
235236
ldap_control_paged_result_response($con, $result, $cookie);
236237

237238
return $cookie;
238239
}
240+
241+
if (null === $result) {
242+
return '';
243+
}
244+
239245
ldap_parse_result($con, $result, $errcode, $matcheddn, $errmsg, $referrals, $controls);
240246

241247
return $controls[\LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'] ?? '';

0 commit comments

Comments
 (0)
0