xperseguers / t3ext-ig_ldap_sso_auth

TYPO3 Extension ig_ldap_sso_auth. This extension provides LDAP and SSO support for TYPO3.
https://extensions.typo3.org/extension/ig_ldap_sso_auth
27 stars 62 forks source link

LDAP Pagination changed in PHP 8 #139

Closed cschnell closed 2 years ago

cschnell commented 2 years ago

The currently used methods for pagination in the LdapUtility class (ldap_control_paged_result and ldap_control_paged_result_response) have been deprecated in PHP 7.4 and have been removed in PHP8. This means that, pagination does not work any more on systems with PHP 8.0 and the classes property hasPagination becomes false. This leads to a break, when the hardcoded limit of 500 records has been reached in the method getEntries()

// Should never happen unless pagination is not supported, for some odd reason
if ($entries['count'] == static::MAX_ENTRIES) {
    break;
}

Which means that at the moment with PHP 8, only the first 500 records can be fetched.

I digged into the new pagination system of the PHP LDAP Extension and found out, how pagination works since PHP 8 - there is a small example at https://www.php.net/manual/en/ldap.examples-controls.php (Example No.5). I updated my version of ig_ldap_sso_auth accordingly and will attach a PR to this issue. All changes are inside a version_compare condition, so that it will still work on PHP 7.3 and smaller.