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

if (!is_file($_FILES['the_file']['tmp_name'])) { fails in latest version (4.28.0) #8559

Closed
olleharstedt opened this issue Oct 10, 2022 · 6 comments · Fixed by #8561
Closed

Comments

@olleharstedt
Copy link
Contributor

olleharstedt commented Oct 10, 2022

Is this a bug?

ERROR: InvalidArrayOffset - application/libraries/ExtensionInstaller/FileFetcherUploadZip.php:228:22 - 
Cannot access value on variable $_FILES using offset value of 'the_file', expecting 'nam
e', 'type', 'size', 'tmp_name' or 'error' (see https://psalm.dev/115)
        if (!is_file($_FILES['the_file']['tmp_name'])) {

This line worked before. The first array access is the name of the posted form input, and can obviously not be limited to a hardcoded set of values.

https://www.php.net/manual/en/features.file-upload.post-method.php

We're using error level 5.

@olleharstedt
Copy link
Contributor Author

Ehm, not the same version on the website? I'm getting different errors:

https://psalm.dev/r/2eb35e1ccb

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/2eb35e1ccb
<?php

if (!is_file($_FILES['the_file']['tmp_name'])) {
}
Psalm output (using commit 028ac7f):

INFO: PossiblyUndefinedStringArrayOffset - 3:14 - Possibly undefined array offset ''the_file'' is risky given expected type 'array-key'. Consider using isset beforehand.

INFO: MixedArrayAccess - 3:14 - Cannot access array value on mixed variable $_FILES['the_file']

INFO: MixedArgument - 3:14 - Argument 1 of is_file cannot be mixed, expecting string

@kkmuffme
Copy link
Contributor

Yeah there are more issues with that, will fix that today

@olleharstedt
Copy link
Contributor Author

Thanks!

@olleharstedt
Copy link
Contributor Author

@kkmuffme When do you guys release, normally?

@orklah
Copy link
Collaborator

orklah commented Oct 11, 2022

I just made a new release :)

I wanted to make sure there was no other regression

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 a pull request may close this issue.

3 participants