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
The helper function arrayToXml has code indended to handle nested arrays, but currently always throws PHP errors. This means nested arrays can't be used when testing soap functions with array data either.
When the function encounters an array, it calls itself to parse the array, with $domNode->$el as the new $domNode parameter. The problem is that that node ->$el will never exist, since that's the node this function was supposed to create in the first place.
Fix
Create a new element first, to pass to the recursive call, and then append that new node to the xml structure.
Alternatively, we could make it a little more consistent by always creating and appending the element in the same way, and only set the value inside the if-condition. That code would look like this:
The helper function arrayToXml has code indended to handle nested arrays, but currently always throws PHP errors. This means nested arrays can't be used when testing soap functions with array data either.
Reproduce
Code:
Expected output:
Result:
Cause
When the function encounters an array, it calls itself to parse the array, with
$domNode->$el
as the new $domNode parameter. The problem is that that node->$el
will never exist, since that's the node this function was supposed to create in the first place.Fix
Create a new element first, to pass to the recursive call, and then append that new node to the xml structure.
Current code:
Fixed code:
Alternatively, we could make it a little more consistent by always creating and appending the element in the same way, and only set the value inside the if-condition. That code would look like this:
Both solutions result in working code for nested arrays.
The text was updated successfully, but these errors were encountered: