Welcome Guest, Not a member yet? Register   Sign In
Strange parse error in Form_validation library : unexpected T_STRING eval()'d code
#7

[eluser]TheFuzzy0ne[/eluser]
If you create this file, it should fix the issue for you.

./system/application/libraries/MY_Form_validation
Code:
class MY_Form_validation extends CI_Form_validation {
    function _reset_post_array()
    {
        foreach ($this->_field_data as $field => $row)
        {
            if ( ! is_null($row['postdata']))
            {
                if ($row['is_array'] == FALSE)
                {
                    if (isset($_POST[$row['field']]))
                    {
                        $_POST[$row['field']] = $this->prep_for_form($row['postdata']);
                    }
                }
                else
                {
                    $post = '$_POST["';
                
                    if (count($row['keys']) == 1)
                    {
                        $post .= current($row['keys']);
                        $post .= '"]';
                    }
                    else
                    {
                        $i = 0;
                        foreach ($row['keys'] as $val)
                        {
                            if ($i == 0)
                            {
                                $post .= $val.'"]';
                                $i++;
                                continue;
                            }
                    
                            $post .= '["'.$val.'"]';
                        }
                    }
                
                    if (is_array($row['postdata']))
                    {                    
                        $array = array();
                        foreach ($row['postdata'] as $k => $v)
                        {
                            $array[$k] = $this->prep_for_form($v);
                        }
                    
                        $post .= ' = '.$array.';';
                    }
                    else
                    {                        
                        $post .= ' = "'.$this->prep_for_form($row['postdata']).'";';
                    }

                    eval($post);
                }
            }
        }
    }
}
// End of file: MY_Form_validation.php
// Location: ./system/application/libraries/MY_Form_validation.php
The above code is untested.

EDIT 1: I think xwero's function is missing the final eval();
EDIT 2: Hmmm, his function is quite different. Me = confused...


Messages In This Thread
Strange parse error in Form_validation library : unexpected T_STRING eval()'d code - by El Forum - 02-23-2009, 07:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB