_shutdown_handler() getting called |
I am having a problem where _shutdown_handler() in common.php is getting called whenever I start up my program under xdebug. I need to know why? There is a call to error_get_last() at the top of it, but the $last_error is null.
function _shutdown_handler() { $last_error = error_get_last(); if (isset($last_error) && ($last_error['type'] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING))) { _error_handler($last_error['type'], $last_error['message'], $last_error['file'], $last_error['line']); } My current theory is that the reason is that some index (such as in $_POST) is not being initialized, but I can't point to a really good reason. I figure that shutdown_handler is a callback that is being triggered by some event, but what? How can I figure out why shutdown_handler is being called? thx for your help.
proof that an old dog can learn new tricks
I did some more research and found this post:
https://forum.codeigniter.com/archive/in...937-2.html I am starting to think that it is an error that is causing this. I figure I have two choices; either to downgrade to php 5.4 from php 5.6.28 OR change the error_reporting level. This second choice seems a little scary to me. I hope to eventually host this thing on Goggle cloud. Do they support older versions of PHP? If not, perhaps I am better modifying the error_reporting level. Where is the proper place in CI to do that mod? Or are their any instructs on downgrading to php 5.4? additional information: $severity=8192 $message= ini_set(): Use of mbstring.internal_encoding is deprecated $filepath=C:\xampp\htdocs\sub_crud\system\core\CodeIgniter.php line 252 And here is the code from codeigniter.php that is causing it: ini_set('default_charset', $charset); if (extension_loaded('mbstring')) { define('MB_ENABLED', TRUE); // mbstring.internal_encoding is deprecated starting with PHP 5.6 // and it's usage triggers E_DEPRECATED messages. @ini_set('mbstring.internal_encoding', $charset); // This is required for mb_convert_encoding() to strip invalid characters. // That's utilized by CI_Utf8, but it's also done for consistency with iconv. mb_substitute_character('none'); I am not sure how I should handle this. I have no idea what mbstring.internal encoding is. Perhaops the Codexworlds login system wasn't meant to be used with php 5.6? There is a comment directly above the problem in codeigniter.php but I don't understand it: * * ------------------------------------------------------ * Important charset-related stuff * ------------------------------------------------------ * * Configure mbstring and/or iconv if they are enabled * and set MB_ENABLED and ICONV_ENABLED constants, so * that we don't repeatedly do extension_loaded() or * function_exists() calls. * * Note: UTF-8 class depends on this. It used to be done * in it's constructor, but it's _not_ class-specific. * */
proof that an old dog can learn new tricks
_shutdown_handler() is always called as the framework completes running. It is part of the normal execution flow.
Look at line 140 in CodeIgniter.php where PHP is told to use _shutdown_handler(). PHP Code: register_shutdown_function('_shutdown_handler'); Read about register_shutdown_function() HERE. The shutdown handler will always be called when script execution ends, whether the end is graceful or not. I don't think error_get_last() will return anything if the problem is an uncaught exception. Got any log or error messages about those? Severity=8192 means that an E_DEPRECATED error was issued, which is just a warning, not fatal. Execution will continue. That tends to indicate that mbstring.internal_encoding is not the issue. |
Welcome Guest, Not a member yet? Register Sign In |