Skip to content

throw ParseException when null input is provided - #658

Merged
phil-davis merged 1 commit into
sabre-io:masterfrom
phil-davis:issue-657
May 27, 2024
Merged

phil-davis merged 1 commit into
sabre-io:masterfrom
phil-davis:issue-657

Conversation

@phil-davis

Copy link
Copy Markdown
Contributor

Issue #657

parse can be called with input null, but the caller should have previously provided an input stream that is already set up.

The change in this PR makes parse throw a ParseException if it is called the first time with null

This should help anyone calling this, or Reader::read() with no input. Instead of getting a PHP Fatal error, they will get an exception.

@codecov

codecov Bot commented May 27, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.78%. Comparing base (72a1fe9) to head (5d7ca00).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #658   +/-   ##
=========================================
  Coverage     98.78%   98.78%           
- Complexity     1869     1870    +1     
=========================================
  Files            71       71           
  Lines          5254     5256    +2     
=========================================
+ Hits           5190     5192    +2     
  Misses           64       64           

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

@alecpl

alecpl commented May 27, 2024

Copy link
Copy Markdown
Contributor

The $input parameter is marked as string|resource|null. So, this is a wrong solution.

@alecpl

alecpl commented May 27, 2024

Copy link
Copy Markdown
Contributor

I'm sorry, I was confused. The solution looks all right.

@phil-davis
phil-davis merged commit 227f681 into sabre-io:master May 27, 2024
@phil-davis
phil-davis deleted the issue-657 branch May 27, 2024 11:04
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