Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Prevents the use of global functions with parameters [Validation] #2357

Closed
demortx opened this issue Oct 21, 2019 · 1 comment
Closed
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@demortx
Copy link

demortx commented Oct 21, 2019

Direction
Prevents the use of custom global functions
Exemple:
function max_int($int, $val, $data = null) { if ($val > $int) return false; else return true; }

$rules['sum'] = array( 'label' => lang('Api/v1/Globals/Payment.sum'), 'rules' => 'min_int[5]', 'errors' => [ 'min_int' => 'min_int...', ] );

Describe the bug
A clear and concise description of what the bug is.

CodeIgniter 4 version
4.0.0-rc.3

Affected module(s)
Validation

Expected behavior, and steps to reproduce if appropriate
CRITICAL - 2019-10-21 19:01:27 --> min_int is not a valid rule. #0 /var/www/site.ru/system/Validation/Validation.php(294): CodeIgniter\Validation\Exceptions\ValidationException::forRuleNotFound('min_int') #1 /var/www/site.ru/system/Validation/Validation.php(175): CodeIgniter\Validation\Validation->processRules('sum', '\xD0\xA1\xD1\x83\', '50', Array, Array) #2 /var/www/site.ru/app/API/v1/Globals/Payment.php(123): CodeIgniter\Validation\Validation->run(Array) #3 /var/www/site.ru/system/CodeIgniter.php(847): App\API\v1\Globals\Payment->checkout() #4 /var/www/site.ru/system/CodeIgniter.php(338): CodeIgniter\CodeIgniter->runController(Object(App\API\v1\Globals\Payment)) #5 /var/www/site.ru/system/CodeIgniter.php(246): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false) #6 /var/www/site.ru/public_html/index.php(45): CodeIgniter\CodeIgniter->run() #7 {main}

Context

  • OS: [Linux]
  • Web server [apache2handler]
  • PHP version [7.2.19-1+ubuntu16.04.1+deb.sury.org+1]
@demortx demortx added the bug Verified issues on the current code behavior or pull requests that will fix them label Oct 21, 2019
@lonnieezell
Copy link
Member

This is not a bug. CI4 uses a different way of getting custom validation rules than previous versions. Please see the validation docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

2 participants