Skip to content
  • Kevin Atkinson's avatar
    Use foreach instead of while (...each) when iterating through $fields, · d4bd798b
    Kevin Atkinson authored
    it's less error prone.  That is change:
      while (list ($name, $attributes) = each ($fields)) {
    to
      foreach ($fields as $name => $attributes) {
    
    This fixes a bug which caused an empty form to display in
    submitpub.php.
    
    When using while (...each) it is important to call reset, before the
    loop to reset the internal array iterator.  We don't ever seam to do
    this, and its clearer to just use foreach.
    
    Someone, eventually, should probably fix all the other cases of using
    each in a while loop, just in case.  But that fix is for another day.
    d4bd798b