← Back to team overview

mahara-contributors team mailing list archive

[Bug 1787493] Re: Unable to have both "" and "0" as options in a select form and have "" the selected one

 

Can you please provide some testing instructions, Robert?

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1787493

Title:
  Unable to have both "" and "0" as options in a select form and have ""
  the selected one

Status in Mahara:
  In Progress

Bug description:
  This is due to the function pieform_element_select_render_options()
  not checking on type

  the line
     $stringvalue = !is_array($values) && $key == $values;

  needs to be
     $stringvalue = !is_array($values) && $key === $values;

  To test create a select field with options like this:

  'options' => array("" => get_string('nocategoryselected', 'mahara')) +
  array_combine(range(100, 0), range(100, 0)),

   and have

  'defaultvalue' = '',

  
  Expected:  we should have the nocategoryselected option displayed
  Currently: we have the option "0" selected

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1787493/+subscriptions


References