Fatal error when uploading a file

Viewing 12 posts - 1 through 12 (of 12 total)
#205584

Hello! How are you?
I’m getting the following error when trying to upload a file via WPDM. This error does not accour when uploading via default WP Media

PHP Fatal error: Uncaught TypeError: finfo_close(): Argument #1 ($finfo) must be of type resource, finfo given in /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php:991
Stack trace:
#0 /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php(991): finfo_close()
#1 /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php(1078): WPDM\__\FileSystem::getMimeType()
#2 /public_html/wp-content/plugins/download-manager/src/Admin/Menu/Packages.php(162): WPDM\__\FileSystem::validateUploadMimeType()
#3 /public_html/wp-includes/class-wp-hook.php(324): WPDM\Admin\Menu\Packages->uploadFile()
#4 /public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#5 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#6 /public_html/wp-admin/admin-ajax.php(192): do_action()
#7 {main}
thrown in /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php on line 991

#205585

The problem seems to be the finfo_close($finfo) command in line 991 of /wp-content/plugins/download-manager/src/__/FileSystem.php
I have commented it and it worked normally

#205587

Tahasin
Moderator

Hello,

I hope this message finds you well. I’m glad to hear that you have successfully identified the issue.
If you have any further questions or require additional assistance, please do not hesitate to reach out.

Regards

#205589

Thanks for the reply!

Just a suggestion — since this issue caused a fatal error and was fixed by removing a single line in a plugin file, it might be worth reviewing this in the plugin code so that other users don’t run into the same problem.

Would be great to see it fixed in a future update.

Thanks again!

#205591

Tahasin
Moderator

Are you using the latest version of Download Manager? If yes, kindly use this hook add_filter("wpdm_is_valid_mime_type", '__return_true'); in your theme’s function.php file and let me know if the problem persists.

Regards

#205738

Michael Nino
Participant

I get this error, and your filter didn’t help, do you have any other ideas?
[27-Apr-2025 00:05:23 UTC] PHP Fatal error: Uncaught Error: Class “finfo” not found in /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php:989
Stack trace:
#0 /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php(1078): WPDM\__\FileSystem::getMimeType(‘/…’)
#1 /public_html/wp-content/plugins/download-manager/src/Admin/Menu/Packages.php(212): WPDM\__\FileSystem::validateUploadMimeType(‘/…’, ‘hydro-one-outag…’)
#2 /public_html/wp-content/plugins/download-manager/src/Admin/Menu/Packages.php(159): WPDM\Admin\Menu\Packages->chunkUploadFile(‘/…’)
#3 /public_html/wp-includes/class-wp-hook.php(324): WPDM\Admin\Menu\Packages->uploadFile(”)
#4 /public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array)
#5 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /public_html/wp-admin/admin-ajax.php(192): do_action(‘wp_ajax_wpdm_ad…’)
#7 {main}
thrown in /public_html/wp-content/plugins/download-manager/src/__/FileSystem.php on line 989

#205739

Michael Nino
Participant

In case it helps in troublshooting, if I remove this line from the .htaccess file:
AddHandler application/x-httpd-ea-php83___lsphp .php .php8 .phtml
The Download Manager works fine. But this line is generated automatically by cPanel so it gets added back, see below how it looks in the .htaccess:

# php — BEGIN cPanel-generated handler, do not edit
# Set the “ea-php83” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php83___lsphp .php .php8 .phtml
</IfModule>
# php — END cPanel-generated handler, do not edit

#205743

Tahasin
Moderator

Thanks for sharing the information, we are checking the issue and will give you an update shortly.

Regards

#205777

Well you replied to me on another support entry. I guess this is not a fix then. Is the syntax correct? All my other functions use single quotes not double. I am not knowledgeable in php.

#205778

Where’s the old version so that we can roll back??????????

#205780

Tahasin
Moderator

Hello, @Tom

If you have apply the mentioned code in your themes functions.php file, the problem should resolve.

Feel free to ask here, if you have any further queries.

Thanks for your understanding

Regards

#205781

Tahasin
Moderator

You can download older versions from here

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.