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

[eluser]Isuka[/eluser]
Thanks for helping.

The PHP version of the server is 5.2.8.
I don't use the Rewrite PHP Short Tags feature, I always use "<?php" tag.

Here is the function with the eval() call, line 457 of my Form_validation library (the 1.7 one):
Code:
// --------------------------------------------------------------------

/**
* Re-populate the _POST array with our finalized and processed data
*
* @access    private
* @return    null
*/        
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);
            }
        }
    }
}
I also can show my controller code but I can't reproduce the bug, so I really don't know where my code can be wrong Tongue I try to know more with my client.


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



Theme © iAndrew 2016 - Forum software by © MyBB