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

PrettyPageHandler to html not working #755

Open
btxtiger opened this issue Mar 28, 2023 · 1 comment
Open

PrettyPageHandler to html not working #755

btxtiger opened this issue Mar 28, 2023 · 1 comment

Comments

@btxtiger
Copy link

btxtiger commented Mar 28, 2023

To reproduce:
I have a very basic composer project (PHP 8.2.4, basic common extensions enabled).

While just having this code in index.php and running it from command line via php -f index.php, the $html is always an empty string.

$e = new \Exception('This is a test exception!');
$whoops = new \Whoops\Run;
$whoops->allowQuit(false);
$whoops->writeToOutput(false);
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$html = $whoops->handleException($e);

error_log($html); // => ""
@bart-jaskulski
Copy link
Contributor

Hi @btxtiger!

I think, you need to add following call in your snippet. Without this using PrettyPageHandler is ignored in CLI context. See this piece of source code.

$whoops->handleUnconditionally(true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants