Merged
Conversation
Remove erroneous $range parameter from recursive SEARCH_AND call and eliminate (a non-working) per-mailbox range slicing, as range handling belongs (and is already done) at the caller level. Add explicit validation to SEARCH_AND unwrapping. Further cleanup and incremental improvements are needed.
- Replace empty()/loose-equality checks with strict !== false comparisons - Fix getElement() logic: return element directly for start/end tags, only loop for content concatenation; eliminates spurious `return false` - Add missing `return false` at end of _getToken() (potential null return bug) - Fix typo: "memeory" -> "memory" in comment - Update @return docblocks to reflect array|boolean return types To be continued.
…nge validation and status codes - Add STORE_STATUS_RANGEERR (12) constant per MS-ASCMD spec - Add default case to search name switch; return STORE_STATUS_PROTERR for unknown store types - Add per-type maxResults limits (mailbox/GAL: 100, documentlibrary: 1000) - Move range parsing out of query map into dedicated $range variable; validate format and enforce maxResults ceiling, returning RANGEERR (12) if exceeded [this also fixes issue with caching done by getSearchResults()]; - Fix mailbox/documentlibrary error status: PROTERR instead of FOLDERSYNC - Move pagination (array_slice) from driver into request handler; driver now returns full result set, caller owns slicing - Replace search_result['rows']/['total'] envelope with flat $rows/$total - Simplify output loop: drop manual $count, derive search_range from $start + count($rows) - Gate backend call behind $store_status === SUCCESS check
ralflang
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove range usage and harden
SEARCH_ANDin_doQuery()SEARCH_ANDcall andeliminate (a non-working) per-mailbox range slicing, as range handling
belongs (and is already done) at the caller level. Add explicit validation
to
SEARCH_ANDunwrapping.Remove reference return from
__get()magic method inHorde_ActiveSync_Message_BaseHarden WBXML decoder against false/empty element checks (to be continued)
!== falsecomparisonsgetElement()logic: return element directly for start/end tags,only loop for content concatenation; eliminates spurious
return falsereturn falseat end of_getToken()(potential null return bug)@returndocblocks to reflectarray|booleanreturn typesOverhaul Search request handling with proper range validation and status codes
STORE_STATUS_RANGEERR(12) constant per MS-ASCMD specSTORE_STATUS_PROTERRforunknown store types
$rangevariable;validate format and enforce max results ceiling, returning
RANGEERR(12) if exceeded[this also fixes issue with caching done by
getSearchResults()];PROTERRinstead ofFOLDERSYNCnow returns full result set, caller owns slicing
search_result['rows']/['total']envelope with flat$rows/$total$start + count($rows)$store_status === SUCCESScheckIMPORTANT: This is required by and relies on changes in horde/Core#57.