Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Prevent possible warnings on unset variables #542

Merged
merged 5 commits into from
Apr 8, 2023
Merged

Prevent possible warnings on unset variables #542

merged 5 commits into from
Apr 8, 2023

Conversation

sudo-plz
Copy link

PHP version: 8.0

Problem
Our server supplies the following value in $_FILES

{
    "files": {
         "tmp_name":["\/tmp\/upload-file-h1gjcc"],
         "name":["file.pdf"]
    }
}

Causing warnings such as:

PHP Warning: Undefined array key "size" in /srv/vendor/guzzlehttp/psr7/src/ServerRequest.php on line 147
PHP Warning: Trying to access array offset on value of type null in /srv/vendor/guzzlehttp/psr7/src/ServerRequest.php on line 147
PHP Warning: Undefined array key "error" in /srv/vendor/guzzlehttp/psr7/src/ServerRequest.php on line 148
PHP Warning: Trying to access array offset on value of type null in /srv/vendor/guzzlehttp/psr7/src/ServerRequest.php on line 148

@stale
Copy link

stale bot commented Apr 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale label Apr 2, 2023
@sudo-plz
Copy link
Author

sudo-plz commented Apr 4, 2023

@GrahamCampbell Can you please take a look?

@stale stale bot removed the lifecycle/stale label Apr 4, 2023
@GrahamCampbell
Copy link
Member

Thanks for the PR. Can you add test coverage please?

@sudo-plz
Copy link
Author

sudo-plz commented Apr 4, 2023

Thanks for your feedback, I added some cases, I hope its up to your standards!

Update: Currently searching why Psalm suddenly decided to call out some unrelated improvements. Are you fine with just updating the baselines?

@TimWolla
Copy link

TimWolla commented Apr 5, 2023

Update: Currently searching why Psalm suddenly decided to call out some unrelated improvements. Are you fine with just updating the baselines?

I suspect this is because of psr/http-message 1.1 being tagged.

@TimWolla
Copy link

TimWolla commented Apr 5, 2023

@sudo-plz I've spun out the update for the psr/http-message interfaces and the baselines into #551.

@GrahamCampbell
Copy link
Member

Please revert the baseline changes, and leave it to fail, so that the PR is atomic.

This reverts commit 8b323ef.
@GrahamCampbell GrahamCampbell merged commit bfe7c39 into guzzle:master Apr 8, 2023
@GrahamCampbell
Copy link
Member

Great, thanks.

@GrahamCampbell
Copy link
Member

We are likely going to do a 2.4.5 release on Monday 17th, so this will be included in that. 🎉

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants