e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
318 stars 212 forks source link

Admin-UI: Using the label 'True' or 'False' in a select (dropdown) displays incorrect labels. #5093

Closed CaMer0n closed 8 months ago

CaMer0n commented 8 months ago

Bug Description

A clear and concise description of what the bug is.

How to Reproduce

$fields['example'] =  array(
    'title'=> 'My title', 
    'type'=>'dropdown', 
    'data' => 'str', ' 
    'writeParms' => ['optArray'=>['true'=>'True', 'false'=>'False', 'other'=>'Other']]
);

Actual Behavior

<option value='true'>1</option>
<option value='false'></option>
<option value='other'>Other</option>

Expected Behavior

<option value='true'>True</option>
<option value='false'>False</option>
<option value='other'>Other</option>

Cause

True and False are constants in PHP, and the option() method checks for constants using defset() on labels before rendering.