imap_search function is not fully compatible with IMAP4. the c-client used as of now supports only IMAP2