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

Skip to content

Commit ec99d01

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 ec99d01

File tree

1 file changed

+9
-3
lines changed
  • src/Symfony/Component/Ldap/Adapter/ExtLdap

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 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
@@ -227,7 +226,7 @@ private function controlPagedResult($con, int $pageSize, string $cookie): bool
227226
* Retrieve LDAP pagination cookie.
228227
*
229228
* @param resource $con
230-
* @param resource $result
229+
* @param resource|null $result
231230
*/
232231
private function controlPagedResultResponse($con, $result, string $cookie = ''): string
233232
{
@@ -236,6 +235,13 @@ private function controlPagedResultResponse($con, $result, string $cookie = ''):
236235

237236
return $cookie;
238237
}
238+
239+
if ($result === 0) {
240+
$this->serverctrls = [];
241+
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