CMS MADE SIMPLE FORGE

Form Builder

 

[#12595] Hacks for get FileUpload field working with PHP8

avatar
Created By: Chris Taylor (chrisbt)
Date Submitted: Tue Jan 17 12:55:43 -0500 2023

Assigned To: Fernando Morgado (JoMorg)
Version: 1.2
CMSMS Version: 2.2.16
Severity: Minor
Resolution: None
State: Open
Summary:
Hacks for get FileUpload field working with PHP8
Detailed Description:
I was having some issues with FileUpload fields on PHP8.0, both when empty &
full

This may not be the best or even an appropriate fix, but it worked for me:

/classes/FileUploadField.class.php:
// if ($this->GetOption('suppress_filename', '0') != '0')   // CT MOD Jan23
- line ~79
    if ($this->GetOption('suppress_filename', '0') == '1')
...
// if ($this->GetOption('remove_file','0') == '1')      // CT Mod Jan23 -
line ~215
    if ( $this->GetOption('remove_file','0') == '1' && !empty($this->Value) )


/classes/FromEmailAddressField.class.php:
			// $val = $this->Value[0];      // CT Mod Jan23 - line ~34
			$val = is_array($this->Value) ? $this->Value[0] : $this->Value;
...
// $val = $this->Value[0] ? $this->Value[0] : $this->GetOption('default');   
// CT Mod Jan23 - line ~44
			$val = !empty($this->Value) ? $this->Value[0] : $this->GetOption('default');


Also had an issue with PHPMailer and attaching images - but that's separate :)

In case it's useful


History