You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Very long story-short: if I want to perform a search like where=Name=="Canal+ SARL", the actual executed query is where=Name%3D%3D%22Canal+%20SARL%22, returning NULL. '+' (plus) symbol didn't become %2B but instead remained + and Xero can't find it (Xero probably thinks + is rather a space character - the %20 to be explicit - ).
Unfortunately this impacts literally every Xero entity: Contacts, Invoices, etc.
How to reproduce
Of course you need to have a Contact in Xero called Canal+ SARL, then:
(new \XeroPHP\Application($access_token, $tenant_id))->load(\XeroPHP\Models\Accounting\Contact::class)->where('Name', 'Canal+ SARL')->execute()
It returns NULL instead of the existing Contact
Additional context
I've spent quite a lot of time understanding that in this case Guzzle is the one to blame, but Guzzle is also right at the same time; as you imagine it's a long and complicated story. I've also opened an issue here if you want to see the evil in the details.
On the xero-php package side, one possible solution to prevent this from happening is replacing + into %2B by ourselves. With this change: where=Name=="Canal%2B SARL" becomes where=Name%3D%3D%22Canal%2B%20SARL%22 and will find the Contact.
The text was updated successfully, but these errors were encountered:
PHP version: x.y.z (hint: php --version)
8.3.6 (Ubuntu 24.04.1)
calcinai/xero-php v2.7.0
Description
Very long story-short: if I want to perform a search like
where=Name=="Canal+ SARL"
, the actual executed query iswhere=Name%3D%3D%22Canal+%20SARL%22
, returning NULL. '+' (plus) symbol didn't become %2B but instead remained + and Xero can't find it (Xero probably thinks + is rather aspace
character - the %20 to be explicit - ).Unfortunately this impacts literally every Xero entity: Contacts, Invoices, etc.
How to reproduce
Of course you need to have a Contact in Xero called
Canal+ SARL
, then:It returns NULL instead of the existing Contact
Additional context
I've spent quite a lot of time understanding that in this case Guzzle is the one to blame, but Guzzle is also right at the same time; as you imagine it's a long and complicated story. I've also opened an issue here if you want to see the evil in the details.
On the
xero-php
package side, one possible solution to prevent this from happening is replacing + into %2B by ourselves. With this change:where=Name=="Canal%2B SARL"
becomeswhere=Name%3D%3D%22Canal%2B%20SARL%22
and will find the Contact.The text was updated successfully, but these errors were encountered: