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 tests failing as of libxml2 2.9.12 #7030

Closed
wants to merge 1 commit into from
Closed

Conversation

stephank
Copy link
Contributor

@stephank stephank commented May 22, 2021

These changes are maybe a bit bold, but let me know what the proper course of action is here. 🙂

As of libxml2 2.9.12 (a security release), some DOM extension tests are failing. See below for the detailed output. How I interpreted these failures:

  • DOMDocument_loadXML_error1.phpt - a minor difference in error reporting because of libxml2 parser changes.

  • DOMDocument_load_error1.phpt - a minor difference in error reporting because of libxml2 parser changes.

  • bug43364.phpt (bug link, original fix) - I don't think we can support this scenario anymore in the new libxml2 version, so that's why I deleted the test. I believe the relevant upstream change is 31c6ce3 (recursion looks to be disabled)

  • bug80268.phpt (bug link, original fix) - I don't think we can support this scenario anymore in the new libxml2 version, so that's why I deleted the test. I believe the relevant upstream change is either dfd4e33 or e050062.

This affects current PHP 7.4(.19) and 8.0(.6). I'm not sure if your policy is to also update 7.3 (in security support) if it involves compatibility with an upstream security release.

There is some downstream NixOS discussion in NixOS/nixpkgs#123279, but that is a process-related issue; there is no specific downstream issue for this yet.

Test run details:

================================================================================
/tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_loadXML_error1.phpt
================================================================================
Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: title line 5 and book in Entity, line: 7 in /tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_loadXML_error1.php on line 7

Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: book line 4 and books in Entity, line: 12 in /tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_loadXML_error1.php on line 7

Warning: DOMDocument::loadXML(): Premature end of data in tag books line 3 in Entity, line: 13 in /tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_loadXML_error1.php on line 7
================================================================================
003+ Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: book line 4 and books in Entity, line: 12 in /tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_loadXML_error1.php on line 7
003- Warning: DOMDocument::load%r(XML){0,1}%r(): %rexpected '>'|Opening and ending tag mismatch: book line 5 and books%r %s
================================================================================



================================================================================
/tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_load_error1.phpt
================================================================================
Warning: DOMDocument::load(): Opening and ending tag mismatch: title line 5 and book in /tmp/build/php-7.4.19/ext/dom/tests/not_well_formed.xml, line: 7 in /tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_load_error1.php on line 8

Warning: DOMDocument::load(): Opening and ending tag mismatch: book line 4 and books in /tmp/build/php-7.4.19/ext/dom/tests/not_well_formed.xml, line: 12 in /tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_load_error1.php on line 8

Warning: DOMDocument::load(): Premature end of data in tag books line 3 in /tmp/build/php-7.4.19/ext/dom/tests/not_well_formed.xml, line: 13 in /tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_load_error1.php on line 8
================================================================================
003+ Warning: DOMDocument::load(): Opening and ending tag mismatch: book line 4 and books in /tmp/build/php-7.4.19/ext/dom/tests/not_well_formed.xml, line: 12 in /tmp/build/php-7.4.19/ext/dom/tests/DOMDocument_load_error1.php on line 8
003- Warning: DOMDocument::load%r(XML){0,1}%r(): %rexpected '>'|Opening and ending tag mismatch: book line 5 and books%r %s
================================================================================



================================================================================
/tmp/build/php-7.4.19/ext/dom/tests/bug43364.phpt
================================================================================
int(11)
================================================================================
001+ int(11)
001- int(13)
================================================================================



================================================================================
/tmp/build/php-7.4.19/ext/dom/tests/bug80268.phpt
================================================================================
Warning: DOMDocument::loadHTML(): Char 0x0 out of allowed range in Entity, line: 1 in /tmp/build/php-7.4.19/ext/dom/tests/bug80268.php on line 3
bool(false)

Warning: DOMDocument::loadHTMLFile(): Char 0x0 out of allowed range in /tmp/build/php-7.4.19/ext/dom/tests/80268.html, line: 1 in /tmp/build/php-7.4.19/ext/dom/tests/bug80268.php on line 9
bool(false)
================================================================================
001+ Warning: DOMDocument::loadHTML(): Char 0x0 out of allowed range in Entity, line: 1 in /tmp/build/php-7.4.19/ext/dom/tests/bug80268.php on line 3
002+ bool(false)
001- bool(true)
002- bool(true)
003+
004+ Warning: DOMDocument::loadHTMLFile(): Char 0x0 out of allowed range in /tmp/build/php-7.4.19/ext/dom/tests/80268.html, line: 1 in /tmp/build/php-7.4.19/ext/dom/tests/bug80268.php on line 9
005+ bool(false)
================================================================================

@nikic
Copy link
Member

nikic commented May 25, 2021

These changes are maybe a bit bold, but let me know what the proper course of action is here. slightly_smiling_face

As of libxml2 2.9.12 (a security release), some DOM extension tests are failing. See below for the detailed output. How I interpreted these failures:

* `DOMDocument_loadXML_error1.phpt` - a minor difference in error reporting because of libxml2 parser changes.

* `DOMDocument_load_error1.phpt` - a minor difference in error reporting because of libxml2 parser changes.

These changes look fine.

* `bug80268.phpt` ([bug link](https://bugs.php.net/bug.php?id=80268), [original fix](https://github.com/php/php-src/commit/6d2bc7253018baa57487f622e706b8962c16d148)) - I don't think we can support this scenario anymore in the new libxml2 version, so that's why I deleted the test. I believe the relevant upstream change is either [dfd4e33](https://gitlab.gnome.org/GNOME/libxml2/commit/dfd4e330489c383c0ae58d5fb1393558d6567bc6) or [e050062](https://gitlab.gnome.org/GNOME/libxml2/commit/e050062ca9f921c6da8e62ff7a42925ba8f08268).

It would be good to split this test based on LIBXML_VERSION. I think it's valuable to check that the new version fails with an error rather than doing something silly like cutting off the document halfway, which is what we were doing originally. It would also be interesting to know whether libxml_use_internal_errors(true) would allow ignoring this error.

* `bug43364.phpt` ([bug link](https://bugs.php.net/bug.php?id=43364), [original fix](https://github.com/php/php-src/commit/b73a36a64f1a1586161cf84bfe9fb48a6666ce1f)) - I don't think we can support this scenario anymore in the new libxml2 version, so that's why I deleted the test. I believe the relevant upstream change is [31c6ce3](https://gitlab.gnome.org/GNOME/libxml2/commit/31c6ce3b63f8a494ad9e31ca65187a73d8ad3508) (recursion looks to be disabled)

Here again, I think we should split the test or adjust the test expectation. Per https://bugs.php.net/bug.php?id=43364 this used to throw warnings and segfault, so I think the fact that this doesn't happen is still worth testing.

This affects current PHP 7.4(.19) and 8.0(.6). I'm not sure if your policy is to also update 7.3 (in security support) if it involves compatibility with an upstream security release.

cc @cmb69

@cmb69
Copy link
Member

cmb69 commented May 25, 2021

I'm not against changing the tests in PHP-7.3, if there is the need to. I don't think that distros will fully update to libxml2 2.9.11/12 in stable versions, though; it's more likely that they'll only apply the sec patch, see e.g. https://metadata.ftp-master.debian.org/changelogs//main/libx/libxml2/libxml2_2.9.10+dfsg-6.7_changelog. And runnintg PHP-7.3 on the latest fancy distro version doesn't appear to be that common, anyway.

For what it's worth, there are currently no plans to update to libxml2 2.9.11/12 for the Windows builds of the stable PHP versions (except for backporting the CVE fix, what already has been done).

@nikic
Copy link
Member

nikic commented May 26, 2021

Based on macos tests, it looks like there are two more failures in ext/libxml tests: https://dev.azure.com/phpazuredevops/PHP/_build/results?buildId=17226&view=ms.vss-test-web.build-test-results-tab

@nikic nikic closed this in f3d1e9e May 26, 2021
@nikic
Copy link
Member

nikic commented May 26, 2021

I made the remaining adjustment myself to fix our CI. I hope I managed to get this merged correctly across branches.

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.

3 participants