This is the scenario:
$cmd = conn()->createCommand($sql);
$rows = CHtml::listData($cmd->queryAll(),'id', 'name');
// it gives Fatal error: Cannot pass parameter 3 by reference.
$return = CHtml::listOptions('0', $rows, array('prompt'=>'','encode'=>true));
//This works perfect
$htmlOptions = array('prompt'=>'','encode'=>true);
$return = CHtml::listOptions('0', $rows, $htmlOptions);
// Here in CHtml::listOptions() the &$htmlOptions is passed BY REFERENCE.
public static function listOptions($selection,$listData, &$htmlOptions )
{ ...}
so if we do not pass htmlOptions by reference every where it works fine, also when it is passed as an inline array rathar than a array vaiable.
But why is this passed by reference? is this necessary for the framework?