Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createElement with special character #18

Open
istvanfodor opened this issue Oct 7, 2016 · 3 comments
Open

createElement with special character #18

istvanfodor opened this issue Oct 7, 2016 · 3 comments

Comments

@istvanfodor
Copy link

Hi Andrew,

I found a small problem: when the billing company of the card data contains a special character(& sign), the code crashed.
Bug place:
Omnipay\Realex\Message\CreateCustomerRequest.php
70. line:
$companyEl = $domTree->createElement('company', $card->getBillingCompany());
My solution was, replace all createElement to this:
$companyEl = $domTree->createElement('company');
$companyEl->appendChild($domTree->createTextNode($card->getBillingCompany()));

@coatesap
Copy link

coatesap commented Oct 7, 2016

Hi Istvanfodor, I can see you've added these commits to PR #16. Are you able to open a separate PR for these, as the endpoint changes are likely to conflict with those in #17 which I'll probably merge, as the implementation seems slightly cleaner?

@joeHickson
Copy link

joeHickson commented Dec 6, 2018

Hi @coatesap ,
This looks to be a slightly wider bug - all the text fields need escaping. Just hit this error in the wild with an '&' in the name field. This seems to be a common issue on multiple drivers though - we also have instances with secure trading, covered by this bug. digitickets/omnipay-secure-trading#5
The proposed fix on secure trading may work here too, using the createTextNode method to automatically escape text strings.

@coatesap
Copy link

coatesap commented Dec 7, 2018

Hi @joeHickson - agreed, I think I've seen the same thing. Do you have permissions to merge? If so, feel free to look at PR #16 and tweak or extract the relevant parts as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants