Skip to content

Conversation

@joelstein
Copy link
Contributor

Example code:

$gather = new Gather;
$gather->gatherUrl = 'https://example.com/bandwidth-call?test1=test1&test2=test2';
$bxml->addVerb($gather);

Expected XML output:

<Gather gatherUrl="https://example.com/bandwidth-call?test1=test1&amp;test2=test2"/>

Actual output:

<Gather gatherUrl="https://example.com/bandwidth-call?test1=test1&amp;amp;test2=test2"/>

Note that the ampersand (&) is double-encoded in the gatherUrl attribute.

This was introduced in #43. It appears the intent was to encode a DOM element's contents. But it also encodes all attributes.

There is no need to encode the attributes. See this example; attributes are encoded automatically.

See this comment about using htmlentities with DOMDocument::createElement. If what is needed is to encode the element's contents (for example, the SpeakSentence contents), then we should either encode the inner element contents, or use DOMDocument::createTextNode.

See this example; using createTextNode automatically an element's contents.

This pull request removes the code added in #43 and replaces it with code to use createTextNode() to encode the inner contents of verbs which need it.

@hamermike hamermike requested a review from ckoegel December 14, 2021 21:40
@ckoegel
Copy link
Contributor

ckoegel commented Dec 16, 2021

This will be merged in in #45

@ckoegel ckoegel closed this Dec 16, 2021
@joelstein
Copy link
Contributor Author

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants