zendesk / zendesk_api_client_php

Official Zendesk API v2 client library for PHP
336 stars 259 forks source link

Can't search for email adresses that contains a plus "+" sign #428

Closed JiDW closed 5 months ago

JiDW commented 5 years ago

Hello,

Right now, you can't search emails that contains a "+" sign (which is a valid email character) because the SDK fails to understand the difference between the character and the Zendesk operator.

For example, this doesn't work:

 $check = $client->users()->search([
            "query"=>"type:user+email:test+alias@gmail.com"
 ]);

It seems to work when you call the REST API directly so it appears to be related to how the PHP client handles it.

See https://develop.zendesk.com/hc/en-us/community/posts/360034827214-Can-t-search-for-emails-with-a-plus-sign for the related forum post.

Thanks

kustomrtr commented 3 years ago

Hello @JiDW, I know this is is super old but just in case someone is looking for help, you can easily solve this by encoding the email like this:

$email = rawurlencode('test+alias@gmail.com');
$check = $client->users()->search([
            "query"=>"type:user+email:$email"
 ]);

Regards.

sudomoke commented 6 months ago

The package should support email addresses that are in compliance with the RFC.

ecoologic commented 5 months ago

Tank you very much for your contribution @kustomrtr.

@sudomoke - I agree this would be ideal, we do accepts open-source contributions. Please use the encoding as suggested in the meantime.