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

Check if $upload['tmp_name'] is set before using it #6486

Merged
merged 3 commits into from Nov 6, 2023

Conversation

qzminski
Copy link
Member

@qzminski qzminski commented Nov 3, 2023

We use the terminal42/contao-fineuploader extension, which provides the files as string values. The Contao form will try to cleanup the temporary files on error, which will result in a TypeError here:

CleanShot 2023-11-03 at 15 29 33

/cc @Toflar

Copy link
Member

@Toflar Toflar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check for an invalid array access.

core-bundle/contao/forms/Form.php Outdated Show resolved Hide resolved
Co-authored-by: Leo Feyer <1192057+leofeyer@users.noreply.github.com>
core-bundle/contao/forms/Form.php Outdated Show resolved Hide resolved
Co-authored-by: Yanick Witschi <yanick.witschi@terminal42.ch>
@leofeyer leofeyer added this to the 4.13 milestone Nov 3, 2023
@leofeyer
Copy link
Member

leofeyer commented Nov 3, 2023

We use the terminal42/contao-fineuploader extension, which provides the files as string values. The Contao form will try to cleanup the temporary files on error

So if there is no tmp_name key, are the files cleaned up at all?

@leofeyer leofeyer modified the milestones: 4.13, 5.2 Nov 3, 2023
@Toflar
Copy link
Member

Toflar commented Nov 3, 2023

Nothing Contao has to worry about. It's just different in Contao 5 vs Contao 4.13 because in 4.13 this check happened on $_SESSION['FILES'] which always contained this format. Now it happens on $arrFiles which is the return value of the widget.

@leofeyer leofeyer changed the title Fix a potential error if the uploaded file is not of an array format with "tmp_name" key Check if $upload['tmp_name'] is set before using it Nov 6, 2023
@leofeyer leofeyer merged commit ef61c2a into contao:5.2 Nov 6, 2023
16 checks passed
@leofeyer
Copy link
Member

leofeyer commented Nov 6, 2023

Thank you @qzminski.

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

Successfully merging this pull request may close these issues.

None yet

4 participants