Skip to content

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

Description

@demortx

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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions