6
votes

Fatal Error

Error: Uncaught TypeError: Argument 1 passed to ErrorHandler::handleException() must be an instance of Exception, instance of Error given in /opt/lampp/htdocs/quiz/lib/Cake/Error/ErrorHandler.php:108 Stack trace: #0 [internal function]: ErrorHandler::handleException(Object(Error)) #1 {main} thrown

File: /opt/lampp/htdocs/quiz/lib/Cake/Error/ErrorHandler.php
Line: 108

I am using cakephp 2.6.1 on php7. I am getting above error. please help me out

3
when you getting above error. Plese provide proper description - Bhavin Solanki
CakePHP v2.x is not compatible with PHP-7. Mainly because it has String class which is reserved in PHP7. - Bogdan Kuštan
Bogdan Kuštan - Just change String to CakeString, and there is at least one other class that has the same problem. This will not solve every php7 issue, but gets you going. - TomTerrific

3 Answers

4
votes
0
votes

Yii Framework --> I have merged code and forget to remove HEAD that is due to conflicts while merging. By removing it, my code start working

0
votes

I made these two changes to cake 2.2.5 to fix fatal error handling using php7. It's not exhaustively tested, but it seems to patch the problem.

/lib/Cake/Error/ErrorHandler.php

public static function handleException( $exception ) {  // remove Exception hint

/lib/Cake/Error/ExceptionRenderer.php

public function __construct( $exception ) { // remove Exception hint