8000 XmlEncoder Bug for big integer attribute value · Issue #22329 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

XmlEncoder Bug for big integer attribute value #22329

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

Closed
smile1980 opened this issue Apr 7, 2017 · 0 comments
Closed

XmlEncoder Bug for big integer attribute value #22329

smile1980 opened this issue Apr 7, 2017 · 0 comments

Comments

@smile1980
Copy link
smile1980 commented Apr 7, 2017
Q A
Bug report? yes
Symfony version 3.2.7

File: symfony\symfony\src\Symfony\Component\Serializer\Encoder\XmlEncoder.php
Method: parseXmlAttributes
Code:

        foreach ($node->attributes as $attr) {
            if (ctype_digit($attr->nodeValue)) {
                $data['@'.$attr->nodeName] = (int) $attr->nodeValue;
            } else {
                $data['@'.$attr->nodeName] = $attr->nodeValue;
            }
        }

If attribute value > "2147483647" then result value exact 2147483647

For example, if the value of the attribute is "8834232342323423423", then the value will be 2147483647.

fabpot added a commit that referenced this issue Apr 23, 2017
…s handling (dunglas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Serializer] XmlEncoder: fix negative int and large numbers handling

| Q             | A
| ------------- | ---
| Branch?       | 2.7 <!-- see comment below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #22329, #22333 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | n/a

Alternative to #22333.

* Negative integers are now handled
* Float are now handled
* Large numbers are converted to float (as the `JsonEncoder` and native PHP functions like `ceil` do)

@vlastv, I've adapted your test. Can you check if it fixes your problem?

Commits
-------

1eeadb0 [Serializer] XmlEncoder: fix negative int and large numbers handling
@fabpot fabpot closed this as completed Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0