• Resolved vincent2546

    (@vincent2546)


    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 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Kev Provance

    (@kprovance)

    Change

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

    it to this

    public function custom_upload_mimes( ?array $existing_mimes = array() ): array {

    I’ll update the next version to reflect this.

    • This reply was modified 2 years, 11 months ago by Kev Provance.
    • This reply was modified 2 years, 11 months ago by Kev Provance.
    Thread Starter vincent2546

    (@vincent2546)

    It works perfectly.
    Thank you very much

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal PHP error raised by custom_upload_mimes function since WP 5.9’ is closed to new replies.