Bug #78450 [NEW]: ldap_parse_result() sets size of LDAP Controll LDAP_CONTROL_PAGEDRESULTS to 0

From: Date: Sat, 24 Aug 2019 11:38:38 +0000
Subject: Bug #78450 [NEW]: ldap_parse_result() sets size of LDAP Controll LDAP_CONTROL_PAGEDRESULTS to 0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222390@lists.php.net to get a copy of this message
From: kagome at opentrash dot com Operating system: Windows 10 / Server 2016 PHP version: 7.3.8 Package: LDAP related Bug Type: Bug Bug description:ldap_parse_result() sets size of LDAP Controll LDAP_CONTROL_PAGEDRESULTS to 0 Description: ------------ ldap_parse_result() sets "size" of LDAP Control LDAP_CONTROL_PAGEDRESULTS to 0 instead of keeping the old value. Test script: --------------- Basicly the Code is the same as here: https://www.php.net/manual/en/function.ldap-control-paged-result.php $searchValue = ldap_escape("P", null, LDAP_ESCAPE_FILTER); // Looking for Computers that has P in name (in my Case more than 2000) // $ldapconn is a valid link identifier for a directory server // $ldaptree is a valid ldaptree $serverctrls = array(); // I need paged results because the Active Directory shows only 1000 Entries max. $serverctrls[LDAP_CONTROL_PAGEDRESULTS] = array("oid" => LDAP_CONTROL_PAGEDRESULTS, "value" => array("size" => 999, "cookie" => "")); $resultData = array(); // Array to store all results do { var_dump($serverctrls); $result = ldap_search($ldapconn, $ldaptree, "(&(objectClass=person)(objectClass=user)(objectClass=organizationalPerson)(objectClass=computer)(|(samaccountname=*".$searchValue."*)(name=*".$searchValue."*)))", array("*"), // default Parameter https://www.php.net/manual/en/function.ldap-search.php 0, // default Parameter -1, // default Parameter -1, // default Parameter LDAP_DEREF_NEVER, // default Parameter $serverctrls); $errcode = $dn = $errmsg = $refs = null; ldap_parse_result($this->ldapconn, $result, $errcode, $dn, $errmsg, $refs ,$serverctrls); // this will update my LDAP Controlls $serverctrls with Cookie infos $data = ldap_get_entries($this->ldapconn, $result); for ($i=0; $i<$data["count"]; $i++) { array_push($resultData, $data[$i]); // push all single Entries to a big array } }while($serverctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'] !== null && $serverctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie'] != ''); return $resultData; Expected result: ---------------- Check the var_dump line: On first run in do-Loop I expect: array(1) { ["1.2.840.113556.1.4.319"]=> array(2) { ["oid"]=> string(22) "1.2.840.113556.1.4.319" ["value"]=> array(2) { ["size"]=> int(999) ["cookie"]=> string(0) "" } } } on the second run in do-Loop I expect: array(1) { ["1.2.840.113556.1.4.319"]=> array(2) { ["oid"]=> string(22) "1.2.840.113556.1.4.319" ["value"]=> array(2) { ["size"]=> int(999) ["cookie"]=> string(0) "CookieContentInformation-bla" } } } So Cookie Information is filled. Actual result: -------------- What I get on second run in do-Loop is: array(1) { ["1.2.840.113556.1.4.319"]=> array(2) { ["oid"]=> string(22) "1.2.840.113556.1.4.319" ["value"]=> array(2) { ["size"]=> int(0) ["cookie"]=> string(0) "CookieContentInformation-bla" } } } Why is "size"-key now 0? -- Edit bug report at https://bugs.php.net/bug.php?id=78450&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78450&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78450&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78450&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78450&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78450&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78450&r=support Expected behavior: https://bugs.php.net/fix.php?id=78450&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78450&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78450&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78450&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78450&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78450&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78450&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78450&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78450&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78450&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78450&r=mysqlcfg

« previous php.bugs (#222390) next »