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

fix: Node.new second argument is typechecked #2401

Merged
merged 1 commit into from
Dec 25, 2021

Conversation

flavorjones
Copy link
Member

What problem is this PR intended to solve?

The second argument to Node.new must be a Node, and it should be a Document (and a warning will be emitted if it is not).

Closes #975

Have you included adequate test coverage?

Yarp

Does this change affect the behavior of either the C or the Java implementations?

Both implementations have been updated.

It must be a Node, it should be a Document (and a warning will be
emitted if it is not).

Closes #975
@flavorjones flavorjones merged commit e981ceb into main Dec 25, 2021
@flavorjones flavorjones deleted the 975-type-check-node-new-param branch December 25, 2021 01:06
javierjulio added a commit to jackpocket/worldpay-cnp that referenced this pull request Jan 27, 2022
This fixes the following deprecation warning:

```
worldpay_cnp-0.1.0/lib/worldpay_cnp/xml/nokogiri.rb:36: warning: Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in a future release of Nokogiri.
```

We are now passing the document along with the parent element. The serializer will handle the case of setting the parent to the document, when the parent is nil due to the recursive nature of the method calls.

This deprecation was included in release 1.13.0 https://github.com/sparklemotion/nokogiri/releases/tag/v1.13.0

For reference: sparklemotion/nokogiri#975 and sparklemotion/nokogiri#2401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node.new should be type-checking the second argument (must be a Document)
1 participant