Skip to content

Commit 908f9c9

Browse files
add Strict Function Params Require Check
1 parent 03bc461 commit 908f9c9

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

application/config/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,4 @@
471471
$config['proxy_ips'] = '';
472472

473473
$config['rewrite_extension'] = "cgi";
474+
$config['strict_function_params'] = true;

system/core/CodeIgniter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,12 @@ function &get_instance()
455455
if ($param->isDefaultValueAvailable()) {
456456
$context_args[] = $param->getDefaultValue();
457457
} else {
458-
$context_args[] = null;
458+
if ($CFG->config['strict_function_params']) {
459+
echo json_encode(['code' => 500, 'message' => 'Params `' . $param->getName() . "` Not Required"]);
460+
exit();
461+
} else {
462+
$context_args[] = null;
463+
}
459464
}
460465
} else {
461466
$context_args[] = !strlen($vars[$param->getName()]) == 0 ? $vars[$param->getName()] : null;

0 commit comments

Comments
 (0)