Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mckillo opened this issue Aug 27, 2024 · 1 comment

Comments

@mckillo
Copy link
Contributor

mckillo commented Aug 27, 2024

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');
				}
			}
		}
	}
mckillo added a commit to mckillo/attachments that referenced this issue Aug 27, 2024
In Jooonla 5, the upload_mime_illegal key doesn't exist in the params of com_media and its reference is deleted in the code.
@parapente
Copy link
Collaborator

Fixed in PR #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants