ci-phpunit-test
ci-phpunit-test copied to clipboard
pre_controller can modify $class / $method
in codeigniter pre_controller methods modifying global $class $method variables can modify the route
code in codeigniter\framework\system\core\CodeIgniter.php
$EXT->call_hook('pre_controller');
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
$CI = new $class();
with this fix, this behavior will work in testing also
Can you show a minimum sample code to modify $class $method variables ? Or please send a PR to https://github.com/kenjis/ci-app-for-ci-phpunit-test
function pre_controller_hook_verify_permissions() {
if( not_have_permission() ){
$GLOBALS['class'] = 'MY_auth_access_denied'; //new controller
$GLOBALS['method'] = 'index'; //new method
}
}
Thank you for sending this PR. I released as v3.0.4.