Skip to content

Handled missing DOM extension during XML import - #540

Merged
pirate-bot merged 2 commits into
developmentfrom
bugfix/539
Oct 24, 2026
Merged

pirate-bot merged 2 commits into
developmentfrom
bugfix/539

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Summary

Improves the robustness of the WXR parser selection logic by ensuring that the SimpleXML parser is only used when both the simplexml extension and the DOMDocument class are available. It also adds comprehensive tests to verify parser selection behavior based on the environment's capabilities.

Check before Pull Request is ready:

Closes #539

@pirate-bot

pirate-bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Plugin build for 282aae5 is ready 🛎️!

@pirate-bot pirate-bot left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes requested

The DOM gate fixes the reported crash, but a host without dom and xml still crashes, and one new test passes without the change.

Validation details
  • Files reviewed: 2/2 changed files.
  • The new tests pass at HEAD: cd /repo && set -o pipefail; timeout 300 phpunit --do-not-cache-result --filter 'WXR_Parser_Test::' 2>&1 | tee /workspac… printed OK (2 tests, 2 assertions) (run R3)
  • On the pr-base parser, the first test still passes: set -o pipefail; cd /workspace/checks/R1b/tree && ls phpunit*.xml* 2>/dev/null; { echo "== HEAD tests, pr-base WXR_Parse… printed OK (1 test, 1 assertion) (run R17) The fallback test fails there.
  • Without dom, pr-base crashes: `cd /workspace/checks/R1 && cat > stub-fs.inc <<'EOF'
Untested areas - The full PHPUnit suite was not run. CI owns it. - The no-DOM runs used a small harness without WordPress. The first failure on the full import path is traced from source only. - The reported host's `xml` extension state is unknown.
🤖 Automated review · run code-review-agent_6adb0d97e50cb1.72756300. --- **🤖 Review agent** — review posted ✅ on `a5b237cf` · [changes requested · 2 findings](https://github.com//pull/540#pullrequestreview-5625483194) · 26 min Run `code-review-agent_6adb0d97e50cb1.72756300` · [trail](https://agents.vertistudio.com/admin/trails/github-pr/Codeinwp-templates-patterns-collection-540)

Comment thread tests/wxr-parser-test.php Outdated
Comment thread includes/Importers/WP/WXR_Parser.php Outdated

@pirate-bot pirate-bot left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

The PR passes. Both earlier findings are fixed, and the re-review found no new problem.

Validation details
  • Files reviewed: 2/2 changed files.
  • The parser tests pass at HEAD: cd /repo && set -o pipefail; timeout 300 phpunit --do-not-cache-result --filter 'WXR_Parser_Test::' 2>&1 | tee /workspac… printed OK (2 tests, 2 assertions) (run R9)
  • Both tests fail with the pr-base parser: set -o pipefail; rm -rf /workspace/checks/R2/base-tree && cp -a /repo /workspace/checks/R2/base-tree && cd /workspace/ch… printed Tests: 2, Assertions: 2, Failures: 2. (run R11)
  • With only simplexml loaded, HEAD returns a readable error: cd /workspace/checks/R2 && sed -i "s#^require '/var/www/html/wp-includes/class-wp-error.php';#&\nrequire '/var/www/html/… printed WXR_parser_unavailable (run R4)
  • With simplexml and xml but no dom, HEAD uses the XML parser: cd /workspace/checks/R2 && set -o pipefail; echo "== (c2) simplexml+xml, no dom"; php -n -d extension=simplexml.so -d ex… printed RESULT: array (run R5)
Untested areas
  • The full PHPUnit suite was not run. CI owns it.
  • The no-DOM runs used a small harness without a full import request.
  • A Beaver Builder import without xml still returns null. That code is unchanged from pr-base.

🤖 Automated review · run code-review-agent_6adb1cde62ba59.52383674.


🤖 Review agent — review posted ✅ on 282aae50 · approved · 0 findings · 9 min

Run code-review-agent_6adb1cde62ba59.52383674 · trail

@pirate-bot
pirate-bot merged commit 3e91642 into development Oct 24, 2026
6 checks passed
@pirate-bot
pirate-bot deleted the bugfix/539 branch October 24, 2026 12:03
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.

2 participants