Skip to content

Return no siblings for an element with no parent, without warnings - #148

Open
gravitypdf-bot wants to merge 2 commits into
mainfrom
fix/issue-139
Open

gravitypdf-bot wants to merge 2 commits into
mainfrom
fix/issue-139

Conversation

@gravitypdf-bot

Copy link
Copy Markdown
Contributor

Fixes #139.

siblings() read $m->parentNode->childNodes without checking for a parent. On a parentless element, such as one made with createElement() and not yet inserted, PHP raised two warnings, which become a fatal error under any error handler that turns warnings into exceptions. siblings() now skips such an element, so the result is an empty set, as in jQuery.

Tests

tests/Issues/Issue139Test.php covers a parentless element, a mixed set, and an element in a detached subtree.

Every PR in this set adds its CHANGELOG line at the end of # Unreleased changes, so each one after the first needs a one-line conflict resolved there.

🤖 Generated with Claude Code

gravitypdf-bot and others added 2 commits October 26, 2026 17:17
siblings() read the parent's childNodes without checking for a parent,
so an element outside any tree raised two warnings.

Fixes #139.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.23%. Comparing base (6ae6acf) to head (2d18494).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #148      +/-   ##
============================================
+ Coverage     90.69%   91.23%   +0.54%     
- Complexity     1424     1442      +18     
============================================
  Files            25       26       +1     
  Lines          3170     3184      +14     
============================================
+ Hits           2875     2905      +30     
+ Misses          295      279      -16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

siblings() raises warnings on an element with no parent

1 participant