EllisLab/CodeIgniter — pull request #2549 by pobieralnia (2013-07-21 21:18:06+00:00)
Title: FIX Form_validation against POST array attack

There should be internal method in form_validation to protect website against POST array attack.

Controller:
public function form()
{
$this->load->library('form_validation');

// single value rule!
$this->form_validation->set_rules('test', 'Test', 'required|trim|xss_clean|integer|numeric|less_than[3]|greather_than[0]');

if($this->form_validation->run()) // validation ok
{
}

}

Attack:
POSTDATA=test[0]=whatever

Result:
A PHP Error was encountered
Severity: Warning
Message: trim() expects parameter 1 to be string, array given
etc ...