Please, help - I cannot find a solution to the following problem. I migrated my project form 1.1.7 to 1.1.8 and now if an error occurs nothing is shown on the screen, the browser hangs until the CErrorHandler max execution time is reached and sometimes even this error is not shown - just a blank white page. When I revert back to 1.1.7 everything works fine - errors are shown right away …
It’s probably in the config/main.php, I tough it was from the php.ini, but it wasn’t (while 1.1.7 is OK with that).
I read the change log and migrating instructions but didn’t find anything that could couse the problem.
but the application doesn’t reach this point, i.e. no error /exception messages on the screen or in the runtime/appliction.log or in the server log files, nothing …
It crashes somewhere in the CErrorHandler I thing …
I figured it out and post the solution here if someone faces the same problem.
Just compared CErrorHandler.php from 1.1.8 and 1.1.7 and it came out that this code in the fuction
public function handle($event)
runs an infinite loop:
if($this->discardOutput)
{
while (ob_get_length())
@ob_end_clean();
}
A possible solution is to extend the class CErrorHandler and overwrite the method handle like this:
public function handle($event)
{
// set event as handled to prevent it from being handled by other event handlers
$event->handled=true;
if($this->discardOutput)
{
// while (ob_get_length())
// @ob_end_clean();
while(@ob_end_clean());
}
if($event instanceof CExceptionEvent)
$this->handleException($event->exception);
else // CErrorEvent
$this->handleError($event);
}