Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display_errors does not work with flight #483

Closed
louishot opened this issue Mar 10, 2023 · 4 comments
Closed

display_errors does not work with flight #483

louishot opened this issue Mar 10, 2023 · 4 comments
Assignees
Labels

Comments

@louishot
Copy link

I have configured display_errors = Off in php.ini but flight still output details of 500 Internal Server Error

Directive Local Value Master Value
allow_url_fopen On On
allow_url_include Off Off
arg_separator.input & &
arg_separator.output & &
auto_append_file no value no value
auto_globals_jit On On
auto_prepend_file no value no value
browscap no value no value
default_charset UTF-8 UTF-8
default_mimetype text/html text/html
disable_classes no value no value
disable_functions no value no value
display_errors Off Off
display_startup_errors Off Off
<h1>500 Internal Server Error</h1><h3>Argument 1 passed to flight\util\Collection::setData() must be of the type array, string given, called in /home/www/api/html/vendor/mikecao/flight/flight/net/Request.php on line 194 (0)</h3><pre>#0 /home/www/api/html/vendor/mikecao/flight/flight/net/Request.php(194): flight\util\Collection->setData()
#1 /home/www/api/html/vendor/mikecao/flight/flight/net/Request.php(158): flight\net\Request->init()
#2 /home/www/api/html/vendor/mikecao/flight/flight/core/Loader.php(125): flight\net\Request->__construct()
#3 /home/www/api/html/vendor/mikecao/flight/flight/core/Loader.php(81): flight\core\Loader->newInstance()
#4 /home/www/api/html/vendor/mikecao/flight/flight/Engine.php(101): flight\core\Loader->load()
#5 /home/www/api/html/vendor/mikecao/flight/flight/Engine.php(314): flight\Engine->__call()
#6 /home/www/api/html/vendor/mikecao/flight/flight/core/Dispatcher.php(198): flight\Engine->_start()
#7 /home/www/api/html/vendor/mikecao/flight/flight/core/Dispatcher.php(144): flight\core\Dispatcher::invokeMethod()
#8 /home/www/api/html/vendor/mikecao/flight/flight/core/Dispatcher.php(49): flight\core\Dispatcher::execute()
#9 /home/www/api/html/vendor/mikecao/flight/flight/Engine.php(92): flight\core\Dispatcher->run()
#10 /home/www/api/html/vendor/mikecao/flight/flight/core/Dispatcher.php(198): flight\Engine->__call()
#11 /home/www/api/html/vendor/mikecao/flight/flight/Flight.php(77): flight\core\Dispatcher::invokeMethod()
#12 /home/www/api/html/index.php(83): Flight::__callStatic()
#13 {main}</pre>
@mjisoton
Copy link

mjisoton commented Apr 17, 2023

What about the error_reporting directive?
It looks like FlightPHP checks if the error level is within the error_reporting directive with a bitwise operation, and then calls the handler function for Exceptions:

public function handleError($errno, $errstr, $errfile, $errline) {
  if ($errno & error_reporting()) {
     throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
  }
}

So, if you really don't want any kind of error to be shown, you probably should set error_reporting=0 in your php.ini. Not sure though.

@krmu
Copy link
Contributor

krmu commented Jan 3, 2024

+1
Tested, specially when you try to render a PHP file (Flight::render). It just wont load, but it has error inside of it.
If file has error outside of the framework, it shows errors correctly but render function gives blank page.

@n0nag0n
Copy link
Collaborator

n0nag0n commented Jan 3, 2024 via email

@krmu krmu added the Bug label Jan 13, 2024
@n0nag0n n0nag0n self-assigned this Jan 13, 2024
@krmu
Copy link
Contributor

krmu commented Jan 13, 2024

Error reporting works when you use Flight::Render for all the files that you have. For me, the fix was to use the renderer for all files that should be used. I will close this for now. If someone still has an issue with this, please create a new issue ticket.

@krmu krmu closed this as completed Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants