Skip to content

$source not passed to OnFileManagerUpload event causing error with FileSluggy extra #2

@travisbotello

Description

@travisbotello

I am trying to get FileUpload extras working with FileSluggy extra for sanitizing file names after upload. However after upload I am receiving the following php error:

PHP message: PHP Fatal error: Uncaught Error: Call to a member function get() on null in /modx/core/cache/config/includes/elements/modplugin/5.include.cache.php:62

Which is referring to this line:

if ($FileSluggy->santizeAllowThisMediaSource($source->get('id'))) {

Reason for this is that in FileUpload's invokeEvent method no $source is passed to OnFileManagerUpload event.

In order to make FileUpload work with other file uploading/sanitizing extras we should consider adding all default event parameters to the invokeEvent method:

https://docs.modx.com/revolution/2.x/developing-in-modx/basic-development/plugins/system-events/onfilemanagerupload

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