Fixed Custom warning title > 255 characters is silently truncated

Xon

Well-known member
Affected version
2.2.12
XML:
<xf:radiorow name="warning_definition_id" value="0"
    label="{{ phrase('warning_type') }}">

    <xf:foreach loop="$warnings" value="$warning">
       <xf:option value="{$warning.warning_definition_id}" class="js-FormFiller">{$warning.title}</xf:option>
    </xf:foreach>
    <xf:option value="0" class="js-FormFiller"
       label="{{ phrase('custom_warning:') }}">

       <xf:textbox name="custom_title" maxlength="{{ max_length($warning, 'title') }}" />
    </xf:option>
</xf:radiorow>

$warning is a XF:WarningDefinition, and not an XF:Warning as such max_length is returning null, and no max length is being applied. And then the XF\Entity\Warning::title property has forced set so it is silently truncating the title if it is too long.

The correct bits should be: maxlength="{{ max_length('XF:Warning', 'title') }}"
And likely remove the "forced" attribute for the column/property so a message is returned if too long data is actually sent to it
 
Last edited:
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.13).

Change log:
Fix max length attribute of custom warning title input
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom