# Sage composers previously working randomly stopped working

**URL:** https://discourse.roots.io/t/sage-composers-previously-working-randomly-stopped-working/30405
**Category:** sage
**Tags:** sage11
**Created:** 2026-07-28T15:49:15Z
**Posts:** 1

## Post 1 by @Quimbyosis — 2026-07-28T15:49:16Z

Mac Os, Flywheel/WP Local, PHP 8.4.4, WP 7.0.2, Sage 11.0.1

Very odd thing happened to a site I’ve been working on. Aside from the 3 Composers that come preloaded, I had created 5 composers. When I went to make some code changes after not looking at it for a week (when all worked), 3 of my composers had just stopped working. I have not made any changes to any of them in about a month. All of them threw the same “Undefined variable” error. I checked, double checked, TRIPLE checked that the correct views were served - they are, and have not been changed. I can see that the Post.php composer is working, and the 2 custom composers I made that are doing more complicated heavy lifting are working. I cannot see any reason why the other three would have stopped working out of seemingly nowhere.

One of the non-working composers & it’s corresponding view  
`<?php`

`namespace App\View\Composers;`

`use Roots\Acorn\View\Composer;`

`class Staff extends Composer`  
`{`  
` /**`  
` * List of views served by this composer.`  
` *`  
` * @var string[]`  
` */`  
` protected static $views = [`  
` 'blocks.staff',`  
` ];`

` /**`  
` * Data to be passed to view before rendering, but after merging.`  
` *`  
` * @return array`  
` */`  
` public function with()`  
` {`  
` return [`  
` 'getStaff' => function($posts) {`  
` $output = [];`

` foreach($posts as $post) {`  
` $output[] = (object)[`  
` 'image' => wp_get_attachment_image_url(get_post_thumbnail_id($post->id), 'full'),`  
` 'title' => get_the_title($post->id),`  
` 'pos' => \carbon_get_post_meta($post->id, 'pos'),`  
` 'ext' => \carbon_get_post_meta($post->id, 'ext'),`  
` 'other' => \carbon_get_post_meta($post->id, 'other')`  
` ];`  
` }`  
` return $output;`  
` }`  
` ];`  
` }`  
`}`

## {{ $data-\>title }}

 @foreach($getStaff($data-\>staff) as $item) 
 @if(!empty($item-\>image )) 
 ![]()
 @endif 

{{ $item-\>pos }}

{!! $item-\>title !!}

{{ $item-\>ext }}

 @if(!empty($item-\>other)) 

{{ $item-\>other }}

 @endif 

 @endforeach 

$getStaff was throwing the error. Has anyone else run into this issue? I had no problems with these until yesterday afternoon. This was the first of the failing composers, so I was looking for some sort of error in it, but I don’t see anything and nothing has been changed since when it was working.
