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

throw ParseException when null input is provided #658

Merged
merged 1 commit into from
May 27, 2024

Conversation

phil-davis
Copy link
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.

Copy link

codecov bot commented May 27, 2024

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
Copy link
Contributor

alecpl commented May 27, 2024

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

@alecpl
Copy link
Contributor

alecpl commented May 27, 2024

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
8 checks passed
@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