From 69b507e3c761e3411fca3fd13cdfc03570820cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20de=20la=20Pe=C3=B1a?= Date: Mon, 7 Sep 2026 18:02:09 +0100 Subject: [PATCH] fix: Pass charset/Security into ErrorHandler mock controller bootstrap pocketarc/codeigniter requires CI_Security($charset) and CI_Input(CI_Security). instantiateMockController() was still calling load_class() with no args, causing ArgumentCountError while rendering fatal error screens. --- src/Common/Service/ErrorHandler.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Common/Service/ErrorHandler.php b/src/Common/Service/ErrorHandler.php index 72ced68d..9d02397e 100644 --- a/src/Common/Service/ErrorHandler.php +++ b/src/Common/Service/ErrorHandler.php @@ -305,7 +305,7 @@ public function showFatalErrorScreen($sSubject = '', $sMessage = '', $oDetails = // -------------------------------------------------------------------------- /** - * Renders the 404 page and halts script execution + * Renders the 404 page andhaltscript execution * * @param bool $bLogError Whether to log the error * @@ -356,7 +356,7 @@ public function show404(bool $bLogError = false) // -------------------------------------------------------------------------- /** - * Renders the 401 page and halts script execution + * Renders the 401 page andhaltscript execution * * @param string $sFlashMessage The flash message to display to the user * @param string $sReturnUrl The URL to return to after logging in @@ -670,9 +670,13 @@ protected static function instantiateMockController() require_once BASEPATH . 'core/Controller.php'; + // Match pocketarc/codeigniter system/core/CodeIgniter.php: + // Security requires $charset; Input requires the Security instance. + $sCharset = strtoupper((string) config_item('charset')); + $oSecurity =& load_class('Security', 'core', $sCharset); + load_class('Output', 'core'); - load_class('Security', 'core'); - load_class('Input', 'core'); + load_class('Input', 'core', $oSecurity); load_class('Lang', 'core'); new NailsMockController();