Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14346

Form Validation - returns "(Anonymous function)"

$
0
0
Hey guys,

i migh've found some bug.

In the docs there is a section called Callable use anything as a rule

I've an object where i do the following
PHP Code:
$this->ci()->load->model('admin/person/Cppersonsave_model');
$this->arrValidationRules[] = array(
    
'field' => 'personid',
    
'label' => 'Duplicatecheck',
    
'rules' => array('check_duplicates', array($this->ci()->Cppersonsave_model,'duplicatesCheck'))
); 




After that i ran the Validation like

PHP Code:
$this->ci()->form_validation->reset_validation();

$this->ci()->form_validation->set_data($arrDbFields);
$this->ci()->form_validation->set_rules($this->arrValidationRules);
if (!
$this->ci()->form_validation->run())
{
    throw new 
FormValidation_Exception(json_encode($this->ci()->form_validation->error_array()));


an excerpt of the model function looks like

PHP Code:
if ($col->count() > 0)
{
    
$this->form_validation->set_message('check_duplicates''This person already exists!');
}

return (
$col->count() > 0   false      true

My model function get called correctly.


But if i do that an error message appears (Anonymous function)

i debugged the code and got the following information 

In line 687 in the Form_validation Library the variable callable is set to true.
On Line 741 the $rule variable gets the callable value which is a boolean and therefore true.


This leads to line 799 which exactly put my message out.

Am i'm missing something here or is this a bug ?

Thx in advance for your answers

Viewing all articles
Browse latest Browse all 14346

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>