Description
When adding a value to "Block Spacing" in a gallery block, I get:
PHP Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /wp-content/plugins/gutenberg/build/block-library/blocks/gallery.php:51
If I var_dump the value of the $gap variable, I get this value:
array(2) { ["top"]=> string(4) "30px" ["left"]=> string(4) "30px" }
If I clear out the block spacing value, or comment out the preg_match line, things work.
Step-by-step reproduction instructions
- Install the gutenberg plugin
- Add a gallery block
- Add a block spacing value
- Get an error
Screenshots, screen recording, code snippet

Environment info
- PHP 8.0.17
- Gutenberg 12.9.0
- WP 5.9.3
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Description
When adding a value to "Block Spacing" in a gallery block, I get:
PHP Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /wp-content/plugins/gutenberg/build/block-library/blocks/gallery.php:51
If I var_dump the value of the $gap variable, I get this value:
array(2) { ["top"]=> string(4) "30px" ["left"]=> string(4) "30px" }If I clear out the block spacing value, or comment out the preg_match line, things work.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes