gourmet / whoops

CakePHP 3 plugin to support Whoops sexy PHP error handling
http://gourmet.github.io/whoops
MIT License
24 stars 1 forks source link

Method App\View\Cell\WhateverCell::__toString() must not throw an exception #7

Open gtrias opened 9 years ago

gtrias commented 9 years ago

I'm having this error with WhoopsHandler, note that with default Cakephp 3 ErrorHandler I can see the trigger_error rised by Cell __toString() method. I'm not sure if the error is from the plugin or the Whoops library itself but I post here because is related with cakephp as well.

This error makes very hard to debug errors on Cell's templates.

To reproduce the error create a cell and on its display.ctp write the next:

<?php

$somearray = array('testing' => 'values');

// then try to echo 
echo $somearray;

Some useful information about this error:

http://stackoverflow.com/questions/2429642/why-its-impossible-to-throw-exception-from-tostring http://www.phpsadness.com/sad/14

jadb commented 9 years ago

Interesting...

What's your PHP's error level? Could be related to that since Whoops I believe catches triggered errors, not just thrown exceptions.

gtrias commented 9 years ago

My PHP error level is 24575.

Which error level should I have?

elboletaire commented 8 years ago

It does not just occur with Cells. I'm having a similar issue with a custom AuthComponent (which also loads custom authenticators, password hashers and custom authorize classes).

Using the default CakePHP error handler shows all the stack and a clear error, whilst using this whoops plugin only shows a PHP7ErrorException:

cakephp error handler

whoops plugin

dereuromark commented 6 years ago

@elboletaire Sounds also like Middleware is a different handler than the low level one. https://github.com/dereuromark/cakephp-whoops should fix things for you.