Welcome Guest, Not a member yet? Register   Sign In
Validation - Array to string conversion error (line 709)

I'm getting an unexpected error (array to string conversion in validation.php on line 709).
Line 709: return str_replace(array("'", '"', '<', '>'), array("'", "&quot;", '&lt;', '&gt;'), stripslashes($data));

I'm trying to validate a form. Part of it contains a variable number of text fields, and so I've used name="printfilenames[]" to get every input as an array. If I submit the form without any data at all, I get the following as my $_POST array (job_id is a hidden input that is automatically populated).

'job_id' => string '22' (length=2)
'printfilenames' =>
0 => string '' (length=0)
'filesavedto' => string '' (length=0)
'instructions' => string '' (length=0)
'jhb' => string '' (length=0)
'pjhb' => string '' (length=0)

These are my validation rules:

The only one that is an array is printfilenames

Here is the printfilenames check function
function printfilenames_check($printfilenames)
        foreach($printfilenames as $it=>$printfilename)
        $this->validation->set_message('filenames_check', 'All Print Filenames are required');
        global $printfilenamesJson;
            return FALSE;
            return TRUE;

The error comes (obviously) after calling $this->validation->run()

I checked the validation.php file, which seems to take care of looking at arrays if present. Why is this error being generated? Any ideas on what I can do?


The complete solution has been given here:

vadivelan, thankyou!

Theme © iAndrew 2016 - Forum software by © MyBB