Skip to content

View composer namespaced wildcards no longer work #44634

@jasonvarga

Description

@jasonvarga
  • Laravel Version: 9.36.0
  • PHP Version: 8.1.6
  • Database Driver & Version: N/A

Description:

Using a view composer with a namespaced wildcard no longer works as of 9.36.0. Likely due to #44487 since it's all about views.

public function boot()
{
    $this->loadViewsFrom(resource_path('namespaced'), 'namespaced');

    View::composer('namespaced::*', fn ($view) => $view->with('foo', 'bar'));
}
{{ $foo }}
Undefined variable $foo

Using a complete wildcard still works. View::composer('*', ...)
It's just the namespaced version that doesn't. View::composer('namespace::*', ...)

Steps To Reproduce:

Here's a GitHub repo with the issue reproduced. Link to commit that adds the problematic bits:
https://github.com/jasonvarga/laravel-view-composer-issue/commit/1548cefdba11aa2c660eb2aab6eb5b5fef2d1958

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions