Skip to content

Gallery Block Gap fatal error #40158

@Jastos

Description

@Jastos

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

  1. Install the gutenberg plugin
  2. Add a gallery block
  3. Add a block spacing value
  4. Get an error

Screenshots, screen recording, code snippet

image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] GalleryAffects the Gallery Block - used to display groups of images[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions