mdius
November 28, 2022, 7:12pm
1
Trying to send a legacy form with an empty File Upload field. I get:
Whoops \ Exception \ ErrorException (E_WARNING)
Undefined array key 6
/updates/concrete-cms-9.1.3/concrete/blocks/form/controller.php
} elseif ($row['inputType'] == 'fileupload') {
$answerLong = '';
$answer = (int) ($tmpFileIds[(int) ($row['msqID'])]); <-- Error line 479
if ($answer > 0) {
$answerDisplay = File::getByID($answer)->getVersion()->getDownloadURL();
} else {
$answerDisplay = t('No file specified');
}
mdius
November 28, 2022, 7:13pm
2
I forgot to add
PHP 8.1.12
If you need/want access to the site I’ll post it, it is my testing site.
That looks like it could be a php8 issue. If you try the site under php7.4 that will provide confirmation.
mdius
November 30, 2022, 1:23pm
4
Works perfectly with PHP 7.4, I should have put that. I will start, if I find any more issues.
Please report the issue on Github.
Thanks @JohntheFish - that’s the best way for sure. Here’s a link to where they should submit on Github: Issues · concretecms/concretecms · GitHub
mdius
December 9, 2022, 1:25pm
7
I did submit this as a bug on GitHub.
2 Likes
Ale
January 9, 2023, 12:09pm
8
One quick fix would be just to check if the array key is set and if not, set the answer to zero:
$answer = (int) (isset($tmpFileIds[$row['msqID']]) ? $tmpFileIds[(int) ($row['msqID'])] : 0);
That being said, the Legacy forms seem to have other PHP8-related problems too. If you try to open form results at /dashboard/reports/forms/legacy, you get:
Non-static method Concrete\Block\Form\MiniSurvey::loadQuestions() cannot be called statically
/concrete/controllers/single_page/dashboard/reports/forms/legacy.php 173
$questionsRS = MiniSurvey::loadQuestions($questionSet);