php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74023 ldap_control_paged_result cannot be undone
Submitted: 2017-01-31 15:00 UTC Modified: 2017-09-27 15:27 UTC
From: markusu49 at aol dot com Assigned: mcmic (profile)
Status: Closed Package: LDAP related
PHP Version: 7.1.1 OS: linux (Ubuntu Server 16.04.1)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: markusu49 at aol dot com
New email:
PHP Version: OS:

 

 [2017-01-31 15:00 UTC] markusu49 at aol dot com
Description:
------------
It's not possible to reset ldap_control_paged_result. Should work with a pagesize of 0. See here: https://www.ietf.org/rfc/rfc2696.txt

"A sequence of paged search requests is abandoned by the client sending a search request containing a pagedResultsControl with the size set to zero (0) and the cookie set to the last cookie returned by the server."

The comments in the docs point this out, too: http://php.net/manual/de/function.ldap-control-paged-result.php#119433

LDAP servers behave differently, OpenLDAP even reacts with a segfault.

Test script:
---------------
https://github.com/markusu49/ldap-pagination/blob/master/ldap.php

Expected result:
----------------
ldap_search returns all entries (eventually limited by server)

Actual result:
--------------
ldap_search returns 0 entries with AD, OpenLDAP segfaults

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-31 15:56 UTC] markusu49 at aol dot com
I created a working java example to show that it's no server side issue:

https://github.com/markusu49/ldap-pagination/blob/master/ldap.java
 [2017-07-26 10:03 UTC] mcmic@php.net
Note that starting from PHP 7.2, as a work-around you can use:
ldap_set_option(ldap, LDAP_OPT_SERVER_CONTROLS, array());

As a work-around to stop pagination.
But please note that this will remove all controls if some other were also set (but this seems unlikely as PHP has little way of adding controls in current releases)
You may use ldap_get_option and check the oid of the controls before removing them.

In future PHP versions proper support for controls will be added and paged result should be easier to manage.
 [2017-09-27 15:27 UTC] mcmic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: mcmic
 [2017-09-27 15:27 UTC] mcmic@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

This is fixed in 7.3 if you use the new way of joining controls to an ldap search.

I think ldap_control_paged_result will get deprecated at some point.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 04:01:28 2024 UTC