I have a form that was working normally until our host updated the PHP version to 7.3.11. Now when you try to submit to the form it gives this error message:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function sl_upload(), 2 passed in /nfs/c07/h03/mnt/113634/domains/myurl.com/html/appLms/modules/question/class.upload.php on line 331 and exactly 3 expected in /nfs/c07/h03/mnt/113634/domains/myurl.com/html/lib/lib.upload.php:74 Stack trace: #0 /nfs/c07/h03/mnt/113634/domains/myurl.com/html/appLms/modules/question/class.upload.php(331): sl_upload('/var/tmp/phpU0P...', '/appLms/test/2_...') #1 /nfs/c07/h03/mnt/113634/domains/myurl.com/html/appLms/lib/lib.test.php(1106): Upload_Question->storeAnswer(Object(Track_Test), Array, '1') #2 /nfs/c07/h03/mnt/113634/domains/myurl.com/html/appLms/modules/test/do.test.php(1208): PlayTestManagement->storePage('1', '1') #3 /nfs/c07/h03/mnt/113634/domains/myurl.com/html/appLms/modules/test/do.test.php(592): showResult(Object(Learning_Test), 29) #4 /nfs/c07/h03/mnt/113634/domains/myurl.com/html/appLms/class.module/learning.test.php(309): in /nfs/c07/h03/mnt/113634/domains/myurl.com/html/lib/lib.upload.php on line 74
I didn't change any of the code. The only thing that changed was the PHP version. As a result, I'm not even sure how to start fixing this.
Here's what's on class.upload.php > line 331
sl_open_fileoperations();
if(!sl_upload($_FILES['quest']['tmp_name'][$this->id], $path.$savefile)) {
$savefile = Lang::t('_QUEST_ERR_IN_UPLOAD');
}
sl_close_fileoperations();
} else {
$savefile = Lang::t('_QUEST_ERR_IN_UPLOAD');
}
}
...and here's what's on lib.upload.php > Line 74
function sl_upload( $srcFile, $dstFile, $file_ext) {
$uploadType = Get::cfg('uploadType', null);
// check if the mime type is allowed by the whitelist
// if the whitelist is empty all types are accepted
require_once(_lib_.'/lib.mimetype.php');
$upload_whitelist =Get::sett('file_upload_whitelist', 'rar,exe,zip,jpg,gif,png,txt,csv,rtf,xml,doc,docx,xls,xlsx,ppt,pptx,odt,ods,odp,pdf,xps,mp4,mp3,flv,swf,mov,wav,ogg,flac,wma,wmv,jpeg');
$upload_whitelist_arr =explode(',', trim($upload_whitelist, ','));
if (!empty($upload_whitelist_arr)) {
$valid_ext = false;
$ext=strtolower(substr(strrchr($dstFile, "."), 1));
if($ext!=""){
$file_ext =strtolower(substr(strrchr($dstFile, "."), 1));
}
foreach ($upload_whitelist_arr as $k=>$v) { // remove extra spaces and set lower case
$ext =trim(strtolower($v));
$mt =mimetype($ext);
if ($mt) { $mimetype_arr[]=$mt; }
getOtherMime($ext, $mimetype_arr);
if ($ext == $file_ext) {
$valid_ext =true;
}
}
$mimetype_arr = array_unique($mimetype_arr);
if ( class_exists('finfo') && method_exists('finfo', 'file')) {
$finfo =new finfo(FILEINFO_MIME_TYPE);
$file_mime_type =$finfo->file($srcFile);
}
else {
$file_mime_type =mime_content_type($srcFile);
}
if (!$valid_ext || !in_array($file_mime_type, $mimetype_arr)) {
return false;
}
}
$dstFile =stripslashes($dstFile);
if( $uploadType == "ftp" ) {
return sl_upload_ftp( $srcFile, $dstFile );
} elseif( $uploadType == "cgi" ) {
return sl_upload_cgi( $srcFile, $dstFile );
} elseif( $uploadType == "fs" || $uploadType == null ) {
return sl_upload_fs( $srcFile, $dstFile );
} else {
$event = new \appCore\Events\Core\FileSystem\UploadEvent($srcFile, $dstFile);
\appCore\Events\DispatcherManager::dispatch(\appCore\Events\Core\FileSystem\UploadEvent::EVENT_NAME, $event);
unlink($srcFile);
return $event->getResult();
}
}
Based on that I'm not sure what to change and I don't want to break what was working before.
All the rest of the website is working normally, including PHP functions like logging in. Thanks in advance for any pointers.