jmcameron / attachments

Attachments Extension for Joomla 3, 4, and 5
GNU General Public License v3.0
12 stars 19 forks source link

php8 Error in Backend -> Option #29

Open st-anton opened 2 years ago

st-anton commented 2 years ago

Hi, when stepping over to php8, the backend options page cannot be opened because of a error: count(): Argument #1 ($var) must be of type Countable|array, null given Frontend does work and adding new attachments does work as well.

peterhulst commented 1 year ago

You can correct that easily. File: /administrator/components/com_attachments/controllers/params.php Line: if (count($errors = $this->get('Errors'))) { replace that line with: $errors = $this->get('Errors'); if (!IS_NULL($errors) and count($errors)) {

Kimball31 commented 1 year ago

@peterhulst, don't you mean !IS_NULL($errors), not !IS_NULL($count)?

        $errors = $this->get('Errors');
        if (!is_null($errors) and count($errors)) 
        {
            JError::raiseError(500, implode("\n", $errors) . ' (ERR 118)');
            return false;
        }
peterhulst commented 1 year ago

You are right. I have corrected it.