Issue Bug Closed

#65689Type cast for BackendUtility::getLabelsFromItemsList()

Georg Ringer 03/12/15, 09:55 updated 10/19/17, 21:14

Description

Because of no strict comparison the mentioned method fails to get the correct value!

Example
@EXT:news@ got the following TCA

'type' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:cms/locallang_tca.xlf:pages.doktype_formlabel',
    'config' => array(
        'type' => 'select',
        'items' => array(
            array($ll . 'tx_news_domain_model_news.type.I.0', 0),
            array($ll . 'tx_news_domain_model_news.type.I.1', 1),
            array($ll . 'tx_news_domain_model_news.type.I.2', 2),
        ),
        'size' => 1,
        'maxitems' => 1,
    )
),

the value of the items is an integer > 0,1,2

if someone extends the extension, like https://github.com/peterkraume/news_exampleextension which adds another type like @blogText”, the core compares

the string “blogtext” vs the integer “0” which is TRUE.

As a solution: use a typecast

Reviews 2