Fix critical extension when reseting paged control

This commit is contained in:
Jérémy Derussé 2020-11-16 12:44:36 +01:00
parent 091265bbbb
commit a2b74762a6
No known key found for this signature in database
GPG Key ID: 2083FA5758C473D2
1 changed files with 5 additions and 5 deletions

View File

@ -100,7 +100,7 @@ class Query extends AbstractQuery
$cookie = ''; $cookie = '';
do { do {
if ($pageControl) { if ($pageControl) {
$this->controlPagedResult($con, $pageSize, $cookie); $this->controlPagedResult($con, $pageSize, true, $cookie);
} }
$sizeLimit = $itemsLeft; $sizeLimit = $itemsLeft;
if ($pageSize > 0 && $sizeLimit >= $pageSize) { if ($pageSize > 0 && $sizeLimit >= $pageSize) {
@ -174,7 +174,7 @@ class Query extends AbstractQuery
private function resetPagination() private function resetPagination()
{ {
$con = $this->connection->getResource(); $con = $this->connection->getResource();
$this->controlPagedResult($con, 0, ''); $this->controlPagedResult($con, 0, false, '');
$this->serverctrls = []; $this->serverctrls = [];
// This is a workaround for a bit of a bug in the above invocation // This is a workaround for a bit of a bug in the above invocation
@ -204,15 +204,15 @@ class Query extends AbstractQuery
* *
* @param resource $con * @param resource $con
*/ */
private function controlPagedResult($con, int $pageSize, string $cookie): bool private function controlPagedResult($con, int $pageSize, bool $critical, string $cookie): bool
{ {
if (\PHP_VERSION_ID < 70300) { if (\PHP_VERSION_ID < 70300) {
return ldap_control_paged_result($con, $pageSize, true, $cookie); return ldap_control_paged_result($con, $pageSize, $critical, $cookie);
} }
$this->serverctrls = [ $this->serverctrls = [
[ [
'oid' => \LDAP_CONTROL_PAGEDRESULTS, 'oid' => \LDAP_CONTROL_PAGEDRESULTS,
'isCritical' => true, 'isCritical' => $critical,
'value' => [ 'value' => [
'size' => $pageSize, 'size' => $pageSize,
'cookie' => $cookie, 'cookie' => $cookie,