Closed phptek closed 12 months ago
Thanks for reporting this. Can you please give a clear set of steps to reproduce this error? You mention previewing a page when an asset doesn't exist - but you haven't described for example how the asset relates to the page?
"[Emergency] Uncaught TypeError: Return value of SilverStripe\Assets\Shortcodes\FileShortcodeProvider::getCachedMarkup() must be of the type string, null returned"
Granted, this is a feature of
silverstripe/cms
, however the culprit is logic found insilverstripe/assets
, specifically inFileShortcodeProvider::getCachedMarkup()
return $item['markup'];
<-- can return null. A simple null coalesce operator "fixes" it alareturn $item['markup'] ?? ''
, but there may be issues insilverstripe/cms
orsilverstripe/framework
where this array value should never benull
. I think this has just surfaced when an explicit:string
return type was naively added to the method.Using Silverstripe
4.12.3
on PHP 7.4PR