Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-17772

Failures when a service alias references another alias

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 4.0.0-a2, 4.0.0-b1
    • Dependency Management
    • None

      The  markpublic_pass  compiler pass assumes that every service alias points directly to a service definition.

      Symfony permits aliases to reference other aliases. When an extension registers an alias chain such as:

      extension.cache_interface:
          alias: text_formatter.cache
      

      where text_formatter.cache is itself an alias, container compilation fails with:

      Undefined array key "text_formatter.cache"
      Call to a member function isPublic() on null
      

      This was encountered while testing the phpBB Pages extension on phpBB 4. Pages decorates text_formatter.cache and retains the canonical alias so that other extensions can compose additional decorators.

      phpBB 3.3.x is unaffected because it does not register markpublic_pass, but other extensions ported to phpBB 4 could trigger the same failure.

      The compiler pass should resolve aliases recursively through Symfony’s container API:

      $container->findDefinition((string) $alias)
      

      This allows direct and chained aliases to be handled consistently while preserving the existing behavior for public and explicitly private definitions.

            Unassigned Unassigned
            MattF Matt Friedman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: