Skip to content

Keep the PHP warning text in exceptions raised from an error - #99

Merged
jakejackson1 merged 1 commit into
mainfrom
fix/issue-91
Oct 25, 2026
Merged

jakejackson1 merged 1 commit into
mainfrom
fix/issue-91

Conversation

@gravitypdf-bot

Copy link
Copy Markdown
Contributor

Fixes #91

ParseException::initializeFromError() passed its arguments to the constructor in the wrong order, so an exception raised from a PHP warning had the error number as its message (2 (/path/to/src/DOMQuery.php: 1343)) and 0 as its code. It now throws new static($errstr, $errno, $errfile, $errline), and the identical override in IOException is removed, since static already gives the right class.

This changes the exception message, so the CHANGELOG entry warns anyone matching on the old text.

Tests: testFailedParseReportsWarning and testFailWriteXMLReportsWarning check that the message contains the warning text and that the code is E_WARNING. Both fail on main.

🤖 Generated with Claude Code

initializeFromError() passed the error number as the message and the
warning text, cast to int, as the code. Pass them in the constructor's
order, and throw static so IOException no longer needs its own copy.

Fixes #91

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gravitypdf-bot gravitypdf-bot changed the title IOException/ParseException raised from a PHP warning lose the warning text — message is the error number Keep the PHP warning text in exceptions raised from an error Oct 25, 2026
@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (7ffe1aa) to head (bfa4f43).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #99      +/-   ##
============================================
+ Coverage     89.84%   90.32%   +0.48%     
+ Complexity     1430     1429       -1     
============================================
  Files            26       25       -1     
  Lines          3189     3184       -5     
============================================
+ Hits           2865     2876      +11     
+ Misses          324      308      -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.

@jakejackson1 jakejackson1 added the bug Something isn't working label Oct 25, 2026
@jakejackson1
jakejackson1 merged commit 0baafe4 into main Oct 25, 2026
14 checks passed
@jakejackson1
jakejackson1 deleted the fix/issue-91 branch October 25, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IOException/ParseException raised from a PHP warning lose the warning text — message is the error number

2 participants