• When I try to export my theme with “export theme”, I get this in debug.log :

    [24-Apr-2024 07:34:43 UTC] PHP Warning: foreach() argument must be of type array|object, null given in /home/MYFOLDER/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php on line 40
    
    [24-Apr-2024 07:34:43 UTC] PHP Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, null given in /home/MYFOLDER/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php:74
    
    Stack trace:
    
    #0 /home/MYFOLDER/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php(74): array_merge()
    
    #1 /home/MYFOLDER/wp-content/plugins/create-block-theme/includes/class-create-block-theme-api.php(386): Theme_Zip::add_activated_fonts_to_zip()
    
    #2 /home/MYFOLDER/wp-includes/rest-api/class-wp-rest-server.php(1230): Create_Block_Theme_API->rest_export_theme()
    
    #3 /home/MYFOLDER/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request()
    
    #4 /home/MYFOLDER/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch()
    
    #5 /home/MYFOLDER/wp-includes/rest-api.php(428): WP_REST_Server->serve_request()
    
    #6 /home/MYFOLDER/wp-includes/class-wp-hook.php(324): rest_api_loaded()
    
    #7 /home/MYFOLDER/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    
    #8 /home/MYFOLDER/wp-includes/plugin.php(565): WP_Hook->do_action()
    
    #9 /home/MYFOLDER/wp-includes/class-wp.php(418): do_action_ref_array()
    
    #10 /home/MYFOLDER/wp-includes/class-wp.php(813): WP->parse_request()
    
    #11 /home/MYFOLDER/wp-includes/functions.php(1336): WP->main()
    
    #12 /home/MYFOLDER/wp-blog-header.php(16): wp()
    
    #13 /home/MYFOLDER/index.php(17): require('/home/noru8363/...')
    
    #14 {main}
    
    thrown in /home/MYFOLDER/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php on line 74
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter antibo

    (@antibo)

    The function get_user_activated_fonts() in plugins/create-block-theme/admin/create-theme/theme-fonts.php return null if (! isset( $user_settings[‘typography’][‘fontFamilies’][‘custom’] ).

    But the array_merge() function in plugins/create-block-theme/admin/create-theme/theme-zip.php at line 74 need an array to populate $theme_json[‘settings’][‘typography’][‘fontFamilies’].

    So return in plugins/create-block-theme/admin/create-theme/theme-fonts.php should be return []; instead of return null;

    Plugin Author Jason Crist

    (@pbking)

    I believe this should be fixed in the 2.1.1 release with the following change:

    https://github.com/WordPress/create-block-theme/pull/582

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal Error : /create-theme/theme-zip.php(74): array_merge()’ is closed to new replies.