Skip to content

Extending a blueprint causes fatal error #2458

@OleVik

Description

@OleVik

Expected Behavior
A user can extend a plugin's blueprints if the plugin has enabled this behavior.

Actual Behavior
After using extends@ with the expected structure, the server refuses to restart.

Specifications
Grav v1.7.49.1 + Admin v1.10.49, Windows 10 x64, PHP v8.2.29 x64

Steps to Reproduce the Problem
Repository with file differences

  1. Downloaded Grav v1.7.49.1 + Admin v1.10.49 and unzipped it
  2. Ran php bin/grav server using PHP v8.2.29, and created an Admin-user
  3. Added public $features = ['blueprints' => 10,]; in user/plugins/markdown-notices/markdown-notices.php per #1804
  4. Modified user/plugins/markdown-notices/blueprints.yaml to import properties:
form:
  validation: strict
  import@:
    type: options
    context: blueprints://plugins/markdown-notices
  1. Added user/plugins/markdown-notices/blueprints/plugins/markdown-notices/options.yaml with the original fields:
form:
  fields:
    enabled:
      type: toggle
      label: PLUGIN_ADMIN.PLUGIN_STATUS
      highlight: 1
      default: 0
      options:
        1: PLUGIN_ADMIN.ENABLED
        0: PLUGIN_ADMIN.DISABLED
      validate:
        type: bool

    built_in_css:
      type: toggle
      label: PLUGIN_MARKDOWN_NOTICES.USE_BUILT_IN_CSS
      highlight: 1
      default: 1
      options:
        1: PLUGIN_ADMIN.ENABLED
        0: PLUGIN_ADMIN.DISABLED
      validate:
        type: bool

    base_classes:
      type: selectize
      label: PLUGIN_MARKDOWN_NOTICES.BASE_CLASSES
      size: large
      placeholder: PLUGIN_MARKDOWN_NOTICES.BASE_CLASSES_PLACEHOLDER
      help: PLUGIN_MARKDOWN_NOTICES.BASE_CLASSES_HELP
      classes: fancy
      validate:
        type: string

    level_classes:
      type: selectize
      label: PLUGIN_MARKDOWN_NOTICES.LEVEL_CLASSES
      size: large
      placeholder: PLUGIN_MARKDOWN_NOTICES.LEVEL_CLASSES_PLACEHOLDER
      help: PLUGIN_MARKDOWN_NOTICES.LEVEL_CLASSES_HELP
      classes: fancy
      validate:
        type: commalist
  1. Cleared cache with php bin/grav clearcache, restarted server, and forced browser refresh
  2. Options show up as expected, and persist without error past a cleared cache
  3. Added user/blueprints/markdown-notices/options.yaml to override a property of a field by extending the base type:
extends@:
  type: options
  context: blueprints://plugins/markdown-notices

form:
  fields:
    enabled:
      label: Modified label
  1. Verified that the label shows the changed text
  2. Stopped server and cleared cache
  3. Trying to start server again now results in a fatal error:
PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in ...\grav-admin-blueprints-crash\vendor\rockettheme\toolbox\ResourceLocator\src\UniformResourceLocator.php on line 271

Referring to this line in RocketTheme/Toolbox, which contains

$uri = (string)preg_replace('|\\\\|u', '/', $uri);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions