CErrorHandler max execution time or White screen on 1.1.8

Hi all,

Congrats to developers for the Yii 1.1.8 release!

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.

Is anyone already had/solved the problem?

Thanks in advance!

Check if the index.php file in your project folder contains




error_reporting(E_ALL);



Also enable an error log route to save exceptions in a log file and also check your webserver error.log file.

kokomo, thanks for the reply.

I’ve put error_reporting(E_ALL); in the index.php file, but doesn’t help.

Here are the log config settings i use:




'log'=>array(

			'class'=>'CLogRouter',

			'routes'=>array(

                            array(

                                    'class'=>'CFileLogRoute',

                                    'levels'=>'error, warning',

                            ),

                            array(

                              'class'=>'XWebDebugRouter',

                              'config'=>'alignLeft, opaque, runInDebug, fixedPos, collapsed',

                              'levels'=>'error, warning, trace, profile, info',

                            ),

			),



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);

	}