Skip to content

The problem in catching exceptions #1274

@demortx

Description

@demortx

The problem occurs when you create a global variable with an object of any class, except that it handles the variables only to an array, but when it receives an exception in the global variable, it throws an internal error.

#0 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler()
#1 {main}
CRITICAL - 2018-09-28 20:33:03 --> Undefined variable: is_install
#0 /var/www/web.ru/application/Modules/Globals/Module/func.php(209): CodeIgniter\Debug\Exceptions->errorHandler(8, 'Undefined varia...', '/var/www/web.r..', 209, Array)
#1 /var/www/web.ru/application/Modules/Globals/Module/Module.php(49): Module\func->ajax_add_ons_renewal()
#2 /var/www/web.ru/application/Controllers/Main.php(234): App\Modules\Globals\Module\Module->App\Modules\Globals\Module\{closure}()
#3 /var/www/web.ru/system/CodeIgniter.php(807): App\Controllers\Main->ajax()
#4 /var/www/web.ru/system/CodeIgniter.php(305): CodeIgniter\CodeIgniter->runController(Object(App\Controllers\Main))
#5 /var/www/web.ru/system/CodeIgniter.php(220): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#6 /var/www/web.ru/public_html/index.php(37): CodeIgniter\CodeIgniter->run()
#7 {main}
CRITICAL - 2018-09-28 20:33:03 --> Uncaught CodeIgniter\Format\Exceptions\FormatException: Failed to parse json string, error: "Recursion detected". in /var/www/web.ru/system/Format/Exceptions/FormatException.php:9
Stack trace:
#0 /var/www/web.ru/system/Format/JSONFormatter.php(61): CodeIgniter\Format\Exceptions\FormatException::forInvalidJSON('Recursion detec...')
#1 /var/www/web.ru/system/API/ResponseTrait.php(367): CodeIgniter\Format\JSONFormatter->format(Array)
#2 /var/www/web.ru/system/API/ResponseTrait.php(120): CodeIgniter\Debug\Exceptions->format(Array)
#3 /var/www/web.ru/system/Debug/Exceptions.php(147): CodeIgniter\Debug\Exceptions->respond(Array, 500)
#4 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ErrorException))
#5 {main}
  thrown
#0 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler()
#1 {main}

It is easy to see that first the exception is normally worked out, and then it is covered by a mistake from the exception itself, and in this case the error is only visible in the log

Sorry for Google translator from Russian

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions