Breaking: #97787 - AbstractMessage->getSeverity() returns ContextualFeedbackSeverity¶
See forge#97787
Description¶
The class \TYPO3\CMS\Core\Messaging\AbstractMessage
and the extended
class \TYPO3\CMS\Core\Messaging\FlashMessage
both have a method
getSeverity()
to return a flash message's severity. The return type of
the method is changed to return an instance of \TYPO3\CMS\Core\Type\ContextualFeedbackSeverity
.
As this method isn't supposed to be used publicly, it is declared internal
now.
Impact¶
Relying on the return type of \TYPO3\CMS\Core\Messaging\AbstractMessage->getSeverity()
being int
will throw a TypeError
exception.
There is no negative impact in the following cases:
- Using the severity enum in Fluid for direct rendering
- Using the severity enum in
json_encode()
In these cases, the enum's value is automatically used.
Affected installations¶
All extensions using \TYPO3\CMS\Core\Messaging\AbstractMessage->getSeverity()
in PHP are affected, if the integer type is expected.
Migration¶
If the integer type of \TYPO3\CMS\Core\Messaging\AbstractMessage->getSeverity()
is expected, use the value
property of the ContextualFeedbackSeverity
enum:
$flashMessage = new \TYPO3\CMS\Core\Messaging\FlashMessage('This is a message');
$severityAsInt = $flashMessage->getSeverity()->value;
The same applies to Fluid template, where the severity is used within another structure, e.g. as an array key:
<div class="x" class="{severityClassMapping.{status.severity.value}}">
<!-- stuff happens here -->
</div>