Bug Description
Cascade::jsonLd() accesses $crumb->title as a property at line 601 of src/Cascade.php:
$breadcrumbs->map(function ($crumb, $index) {
return [
'@type' => 'ListItem',
'position' => $index,
'name' => $crumb->title, // ← accesses protected property directly
'item' => $crumb->absoluteUrl(),
];
})
Statamic\Structures\Page::$title is a protected property. In a normal front-end rendering context, the HasAugmentedInstance::__get() magic method intercepts the property access and it works fine. However, when an Entry is serialized from a different context — specifically via json_encode() triggered by Laravel Telescope's ExtractProperties — the __get() interception doesn't apply and PHP throws:
Error: Cannot access protected property Statamic\Structures\Page::$title
Call chain that triggers the bug
- Telescope's
ExtractProperties::from() calls json_encode() on a Statamic Entry object
Entry implements JsonSerializable → calls toArray() → toEvaluatedAugmentedArray()
- This augments the
seo field, which triggers SEO Pro's Cascade::get() → Cascade::jsonLd()
jsonLd() fetches breadcrumbs via Statamic::tag('nav:breadcrumbs')->fetch()
- The resulting
Page objects have $title as a protected property, causing the error
How to Reproduce
- Install Laravel Telescope in a Statamic application with SEO Pro
- Enable
json_ld_breadcrumbs: true in resources/addons/seo-pro.yaml
- Visit any page with breadcrumbs (i.e. any page beyond the homepage)
- The error is thrown/logged on every such request
Suggested Fix
Change $crumb->title to $crumb->title() on line 601 of src/Cascade.php, calling the public method instead of relying on __get():
- 'name' => $crumb->title,
+ 'name' => $crumb->title(),
Environment
- Statamic: v6.5.0
- SEO Pro: v7.1.1
- Laravel: v12
- PHP: 8.5.3
- Telescope: 5.18.0
Bug Description
Cascade::jsonLd()accesses$crumb->titleas a property at line 601 ofsrc/Cascade.php:Statamic\Structures\Page::$titleis aprotectedproperty. In a normal front-end rendering context, theHasAugmentedInstance::__get()magic method intercepts the property access and it works fine. However, when an Entry is serialized from a different context — specifically viajson_encode()triggered by Laravel Telescope'sExtractProperties— the__get()interception doesn't apply and PHP throws:Call chain that triggers the bug
ExtractProperties::from()callsjson_encode()on a StatamicEntryobjectEntryimplementsJsonSerializable→ callstoArray()→toEvaluatedAugmentedArray()seofield, which triggers SEO Pro'sCascade::get()→Cascade::jsonLd()jsonLd()fetches breadcrumbs viaStatamic::tag('nav:breadcrumbs')->fetch()Pageobjects have$titleas a protected property, causing the errorHow to Reproduce
json_ld_breadcrumbs: trueinresources/addons/seo-pro.yamlSuggested Fix
Change
$crumb->titleto$crumb->title()on line 601 ofsrc/Cascade.php, calling the public method instead of relying on__get():Environment