techjoomla / com_api

API framework for Joomla
http://docs.techjoomla.com/joomla-rest-api/com-api-introduction
GNU General Public License v3.0
123 stars 97 forks source link

Bug #117018 When the response is set to accept XML, and the response … #67

Closed vaivk369 closed 5 years ago

vaivk369 commented 6 years ago

…has an array with the numric indexes, response is broken

sushan05 commented 6 years ago

@twsvaishali , @coolbung , @thite-amol - I have tested this PR for GET and POST request by setting Accept header as application/xml and I am getting the response as expected.

coolbung commented 6 years ago

Can you also comment on whether this is the right approach ?

What about alphanumeric strings starting with numbers for example

On Sat, Jan 06, 2018 at 3:04pm, sushan05 < notifications@github.com [notifications@github.com] > wrote: @twsvaishali [https://github.com/twsvaishali] , @coolbung [https://github.com/coolbung] , @thite-amol [https://github.com/thite-amol] - I have tested this PR for GET and POST request by setting Accept header as application/xml and I am getting the response as expected .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [https://github.com/techjoomla/com_api/pull/67#issuecomment-355735330] , or mute the thread [https://github.com/notifications/unsubscribe-auth/AAaNMwWACBOcvAqGUKhLU9CPnpSkU3ybks5tHz4bgaJpZM4RVODS] .

vaivk369 commented 6 years ago

XML breaks if index starts with numbers or some special characters

coolbung commented 6 years ago

I want you to comment on the 2 points that I added, especially @sushan05 @thite-amol

coolbung commented 6 years ago

This needs a closure @twsvaishali please update the code to address to ensure any kind of keys will work in XML. I suggest you use some method to make the key 'safe' to be used as a XML node before prefixing with 'node_'