Skip to content

When upload the file -> Deprecated: explode(): Passing null to parameter #2 ($string)  #64

Description

@mckillo

Message:
Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in ...\components\com_attachments\src\Helper\AttachmentsHelper.php on line 642

image

In this line 642: $illegal_mime = explode(',', $cmparams->get('upload_mime_illegal'));
upload_mime_illegal key doesn't exits in params of com_media componenet of Joomla 5 (see content of params for J5 #63)
and the line 642 must delete and in the line 643 delete the reference too.

The fix code (see in the commit by PR):

	if ( $cmparams->get('check_mime', true) ) {
		$allowed_mime = explode(',', $cmparams->get('upload_mime'));
		if ( StringHelper::strlen($ftype) && !in_array($ftype, $allowed_mime)) {
			$error = 'illegal_mime_type';
			$error_msg = Text::sprintf('ATTACH_ERROR_UPLOADING_FILE_S', $filename);
			$error_msg .= ', ' . Text::_('ATTACH_ERROR_ILLEGAL_FILE_MIME_TYPE') . " $ftype";
			if ($user->authorise('core.admin')) {
				$error_msg .= "	 <br />" . Text::_('ATTACH_ERROR_CHANGE_IN_MEDIA_MANAGER');
				}
			}
		}
	}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions