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

XML formater xmltoarray indexed array incorrect #577

Closed
bytedevzone opened this issue Jun 29, 2017 · 6 comments
Closed

XML formater xmltoarray indexed array incorrect #577

bytedevzone opened this issue Jun 29, 2017 · 6 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@bytedevzone
Copy link

Don't check numeric key
https://github.com/bcit-ci/CodeIgniter4/blob/develop/system/Format/XMLFormatter.php#L95

Solution

if (! is_numeric($key))
{
$output->addChild("$key", htmlspecialchars("$value"));
} else
{
$output->addChild("item{$key}", htmlspecialchars("$value"));
}

@lonnieezell
Copy link
Member

This looks good, but can you provide some sample code that was generating the problem you saw so that I can double-check and verify.

@bytedevzone
Copy link
Author

Return data:
return $this->respond([
'productname' => 'Appale',
'tags' => ['Vitamin', 'Fruit']
]);

====================

XML Parsing Error: not well-formed
Location: http://localhost/ympcl1local/ax-app/public/entity/save
Line Number 2, Column 51:Appale<0>Vitamin</0><1>Fruit</1>
--------------------------------------------------^

@jim-parry jim-parry added investigating bug Verified issues on the current code behavior or pull requests that will fix them and removed investigating labels Jul 13, 2017
@samsonasik
Copy link
Member

this should already fixed and can be closed.

@lonnieezell
Copy link
Member

@samsonasik can you link to the specific code that fixed it? I'll need to ensure we have a test in the system to ensure this works, so want to make sure I get the test right :)

@lonnieezell
Copy link
Member

@samsonasik Perfect. Thanks! Will close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

4 participants