![]() |
I have this rule
Code: $validation->setRule('email','Email', 'required|max_length[254]|valid_email|is_unique[users.email,id,{id}]'); When the validation run i get this error LogicException No validation rules for the placeholder: id SYSTEMPATH/Validation/Validation.php at line 792 the users table has an id field. I don't understrand where is the error Thank you in advance The placeholder don't recognize the id field value This line work fine Code: $validation->setRule('email','Email', "required|max_length[254]|valid_email|is_unique[users.email,id,{$id}]");
You have to look in the manual for string-operations with variables :
https://www.php.net/manual/en/language.o...string.php
This code is vulnerable. An attacker could substitute an arbitrary string for $id and execute the code.
Therefore, you should not write such code. PHP Code: $validation->setRule('email','Email', "required|max_length[254]|valid_email|is_unique[users.email,id,{$id}]"); Quote:Since v4.3.5, you must set the validation rules for the placeholder field (the id field in the sample code above) for security. |
Welcome Guest, Not a member yet? Register Sign In |