WordPress / create-block-theme

A WordPress plugin to create block themes
https://wordpress.org/plugins/create-block-theme/
GNU General Public License v2.0
310 stars 44 forks source link

Fatal Error at add_activated_fonts_to_zip() when exporting theme to zip; theme export fails #585

Closed skorasaurus closed 2 months ago

skorasaurus commented 2 months ago

On 2.1.0 of create-block-theme ; receive an error that the zip fails; this appears in my debug.log

I am successfully able to zip my theme using 1.3.8.

[23-Apr-2024 19:33:25 UTC] PHP Fatal error:  Uncaught TypeError: array_merge(): Argument #2 must be of type array, null given in //path/to/my/site/public/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php:76
Stack trace:
#0 //path/to/my/site/public/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php(76): array_merge()
#1 //path/to/my/site/public/wp-content/plugins/create-block-theme/includes/class-create-block-theme-api.php(386): Theme_Zip::add_activated_fonts_to_zip()
#2 //path/to/my/site/public/wp-includes/rest-api/class-wp-rest-server.php(1230): Create_Block_Theme_API->rest_export_theme()
#3 //path/to/my/site/public/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request()
#4 //path/to/my/site/public/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch()
#5 //path/to/my/site/public/wp-includes/rest-api.php(428): WP_REST_Server->serve_request()
#6 //path/to/my/site/public/wp-includes/class-wp-hook.php(324): rest_api_loaded()
#7 //path/to/my/site/public/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#8 //path/to/my/site/public/wp-includes/plugin.php(565): WP_Hook->do_action()
#9 //path/to/my/site/public/wp-includes/class-wp.php(418): do_action_ref_array()
#10 //path/to/my/site/public/wp-includes/class-wp.php(813): WP->parse_request()
#11 //path/to/my/site/public/wp-includes/functions.php(1336): WP->main()
#12 //path/to/my/site/public/wp-blog-header.php(16): wp()
#13 //path/to/my/site/public/index.php(17): require('...')
#14 {main}
  thrown in //path/to/my/site/public/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php on line 76

Theme is available at https://gitlab.com/cpl/uniblack ; I haven't tried other themes.

pbking commented 2 months ago

This seems to be caused because it is attempting to add fonts to the zip file when there are no fonts to add, and an error is thrown. #584 should fix this.