Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Fatal PHP error raised by custom_upload_mimes function since WP 5.9

$
0
0

Replies: 0

Hello,

I noticed that since I update my WP to 5.9.X, Extendify triggers a PHP fatal error (the site is no longer browsable).
This error is displayed :

2022/03/24 10:53:47 [error] 23588#23588: *2031 FastCGI sent in stderr: “PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Redux_Extension_Import_Export::custom_upload_mimes() must be of the type array, null given, called in […]/public/wp-includes/class-wp-hook.php on line 309 and defined in […]/public/wp-content/plugins/redux-framework/redux-core/inc/extensions/import_export/class-redux-extension-import-export.php:72

I noticed that this function (in class-redux-extension-import-export.php)

public function custom_upload_mimes( array $existing_mimes = array() ): array {…}

wasn’t made to receive the “NULL” value as $existing_mimes. This is a problem since wordpress can apparently give the NULL value for this (and that’s what happens on my site).

I changed the function to :

public function custom_upload_mimes( $existing_mimes = array() ): array {
if (is_null($existing_mimes)) {
$existing_mimes = array ();
}
$existing_mimes[‘redux’] = ‘application/redux’;

return $existing_mimes;
}

(the parameter’s type restriction “array” has been retrieved and I handle the case when $existing_mimes is null)
and my site does not show any error and works just fine.

I wish you could add this to future versions of Extendify since without this fix my site is broken.
If there is another way to fix this, I also would like to know it.

Thank you very much

Vincent


Viewing all articles
Browse latest Browse all 59525

Trending Articles