Backport of #10527

properly cancel a Paginated Results operation in order to avoid protocol errors, fixes #10526

abandon ongoing paged search before starting a new one

abandond paged search only if PHP supports them

init a new paged search on read operations to satisfy OpenLDAP

make scrutinizer happy, very minor changes