-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Bug in Magento\Framework\Simplexml\Element::appendChild #1035
Comments
Thanks for submitting this pull request. We will process it internally through ticket MAGETWO-34069.
ex:
|
Thanks for the quick response Anup! I did not yet create a pull request proper as my local version of Magento2 is outdated and I was concerned about setup for unit tests. Did you need a proper pull request for this? |
@tim-reynolds Pull request is highly encouraged. Here's our contribution guide: Here's the Unit test in question : https://github.com/magento/magento2/blob/develop/dev/tests/unit/testsuite/Magento/Framework/Simplexml/ElementTest.php For running this Unit test:
Feel free to check out our documentation regrading installation and updating your dependencies http://devdocs.magento.com/guides/v1.0/install-gde/install/prepare-install.html |
One of the reasons for submitting a pull request is so your name is associated with the code as the contributor of the solution. So it's not mandatory to get it fixed (we can add to our bug backlog), it's just the best way to give you full credit for your contribution. You will have your name as a contributor in github for the world to see. |
@alankent - Yeah, hopefully my name is already in. I think I've sent at least one maybe two bug patches into the project, but that was early when they weren't giving attribution on fixes. Working on a PR now. |
magento#1035 A bug in the appendNode method of Magento\Framework\Simplexml\Element.php causes values to be lost in very specific cases. This will fix it. The existing unit test for appendNode has been updated as well. Bug: When appending a node that has an attribute and no child nodes, the code will take the code path for having children. This is because the result of $source->children() evaluates to TRUE when a node has attributes and no children. Fix: Changing to call from [children()] to [count()] fixes the issue.
The associated Pull request has been merged, closing the issue. Thanks again for your contribution! |
…ON_ERROR MAGETWO-63116: [GitHub] Quotes in product name causes JSON error on product page MAP What's This Popup #8059
MSI-1033: Saving configurable product automatically makes its children in stock
The bug is in the call to:
$source->children()
If an XML node has no child nodes and no attributes, this resolves to FALSE
However, if the XML node has no children and has one or more attributes it resolves to TRUE when clearly it should not.
See the line of code in question:
https://github.com/magento/magento2/blob/develop/lib/internal/Magento/Framework/Simplexml/Element.php#L329
This line needs to be changed to
if(count($source->children())) {
Please see this Gist
https://gist.github.com/tim-reynolds/ac20289acdcfcde3633f
The bug exists in Magento 1.X as well as 2.0.
I would really blame PHP SimpleXMLElement but we can't readily fix that.
The text was updated successfully, but these errors were encountered: