-
Notifications
You must be signed in to change notification settings - Fork 41
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
array with one integer key not zero converted to array and not to struct #82
Comments
Just adding that this is happening when have more then 1 integers keys in ascending order If they will be in some randomly order , i.e 4036, 4035 ... they will be converted to structs with member node. |
@shushu304 could you test #84 which should address your issues? |
Thanks Lars, I tested and looks ok. This is what I got for the example I posted:
And for the comment of more then 1 integers keys in ascending order: |
Fixed with #84 |
Hello,
I found something very interesting and I even don't know and not sure if it is a bug or this is how it supposed to work.
When having an array with one key that is integer but not 0 - zero ,
it converted to xml array with data-values,
instead of been struct with member node.
example:
array (
0 => 'something',
1 => '15632',
2 => 1395,
3 => '25/05/2021',
4 => array (
4035 => array (
0 => 3600,
1 => 3700,
2 => 4200,
),
),
)
see the 4035 key that in this case represent an id of something, and holds list values.
the output xml of this part is:
<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>update_plan_prices</methodName><params><param><value><string>something</string></value></param><param><value><string>15632</string></value></param><param><value><int>1395</int></value></param><param><value><string>25/05/2021</string></value></param><param><value><array><data><value><array><data><value><int>3600</int></value><value><int>3700</int></value><value><int>4200</int></value></data></array></value></data></array></value></param></params></methodCall>
instead of been converted to:
<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>update_plan_prices</methodName><params><param><value><string>something</string></value></param><param><value><string>15632</string></value></param><param><value><int>1395</int></value></param><param><value><string>25/05/2021</string></value></param><param><value>**<struct><member>**<name>4035</name><value><array><data><value><int>3600</int></value><value><int>3700</int></value><value><int>4200</int></value></data></array></value>**</member></struct>**</value></param></params></methodCall>
I assume it is happening in this part if I'm using XmlWriterSerializer
https://github.com/lstrojny/fxmlrpc/blob/master/src/fXmlRpc/Serializer/XmlWriterSerializer.php#L138
and also if use the NativeSerializer
https://github.com/lstrojny/fxmlrpc/blob/master/src/fXmlRpc/Serializer/NativeSerializer.php
with the build in function xmlrpc_encode_request
https://www.php.net/manual/en/function.xmlrpc-encode-request.php
The text was updated successfully, but these errors were encountered: