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

Server Upgraded to PHP7 Error: __toString() must not throw an exception #703

Open
velkymx opened this issue Feb 1, 2017 · 4 comments
Open

Comments

@velkymx
Copy link

velkymx commented Feb 1, 2017

ErrorException [ Fatal Error ]: Method View::__toString() must not throw an exception, caught ParseError: syntax error, unexpected 'else' (T_ELSE)

screenshot 2017-02-01 15 52 08

@ghost
Copy link

ghost commented Oct 15, 2017

Any answer? I have similar problem...

@Ikke
Copy link
Contributor

Ikke commented Oct 16, 2017

@Pantela777 Kohana is no longer maintained, so there will be no PHP7 support.

@timhj
Copy link

timhj commented Oct 17, 2017 via email

@ejg
Copy link

ejg commented Oct 25, 2017

I fixed this by changing the catch in the __toString function in system/classes/Kohana/View.php to

catch (Throwable $e)

in PHP7, fatal and recoverable errors extend a new Error class instead of of the Exception class. I found the explanation on this blog: https://www.aurigait.com/blog/fatal-error-handling-in-php-7/

-- Edited to change catch (Error $e) to catch (Throwable $e) since ErrorExcecptions were causing the toString problem with catch Error. https://trowski.com/2015/06/24/throwable-exceptions-and-errors-in-php7/

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

4 participants