rails/activesupport/test/xml_mini
Mike Dalessio 76bfda8f72
Remove leading whitespace from the XML under test
This test was originally written with the intention of asserting that
a runtime error related to XXE will be raised by the parser. However,
because initial whitespace is present before the doctype,
XmlMini_NokogiriSAX::HashBuilder has been raising an unrelated error
in this test.

Related to #41015

---

Using Nokogiri v1.10.10, the error being raised without this change
is:

> XML declaration allowed only at the start of the document

but with this change we see the expected exception from the libxml2
SAX parser:

> Entity 'a' not defined

Using Nokogiri v1.11.0, in which error handling is broken (see
sparklemotion/nokogiri#2168), without this change we see an exception
being raised by HashBuilder because `characters` is called before
`start_element` and so the content hash isn't initialized (see

The error being raised with this change is:

> Parse stack not empty!

which is not the error we want (because of
sparklemotion/nokogiri#2168), but the test still passes.

Using Nokogiri with the fix from sparklemotion/nokogiri#2169, the
error being raised without this change is:

> XML declaration allowed only at the start of the document

but with this change will be:

> Entity 'a' not defined

and we're back to the expected behavior.
2021-01-05 22:29:25 -05:00
..
jdom_engine_test.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` 2017-07-11 13:12:32 +09:00
libxml_engine_test.rb Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the future 2017-12-14 17:30:54 +09:00
libxmlsax_engine_test.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` 2017-07-11 13:12:32 +09:00
nokogiri_engine_test.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` 2017-07-11 13:12:32 +09:00
nokogirisax_engine_test.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` 2017-07-11 13:12:32 +09:00
rexml_engine_test.rb Add `Style/RedundantFreeze` to remove redudant `.freeze` 2018-09-29 07:18:44 +00:00
xml_mini_engine_test.rb Remove leading whitespace from the XML under test 2021-01-05 22:29:25 -05:00