Yii 1.1.1 Performance Profiling always throws mismatching code block

I’m quite new to Yii and I tried to do a Performance Profiling as described in the guide. I’m always getting a CException telling me "CProfileLogRoute found a mismatching code block “block”. I tried many things but this is the only result I got. Here is what is enough to generate the exception

In my protected/config/main.php


  // ...


  // preloading 'log' component

  'preload'=>array('log'),


  //...


  // application components

  'components'=>array(

    //...


    'log'=>array(

      'class'=>'CLogRouter',

        'routes'=>array(

          array(

           'class'=>'CProfileLogRoute',

        ),

      ),

    ),

  ),


  //...

And somewhere in a view or an action


<?php

Yii::beginProfile('block');

Yii::endProfile('block');

?>

No matter where I actually put this code, the result is always the same: Using Yii 1.1.0 this works very well, using Yii 1.1.1 this creates the described exception.

After I read the change log and some source code, to me theres nothing changed in Performance Profiling from Yi 1.1.0 to Yii 1.1.1. So why does this happen?

EDIT: Corrected code listing

Where are your endProfile() calls?

Sorry, I failed copying source code into the post. Of course there is an endProfile() call. I’ve updated my first post.

I can confirm this bug. It seems that the profiling block name gets a bunch of information tacked on, causing the blocks to no longer match.


Yii::beginProfile('controllerInit');

Yii::endProfile('controllerInit');

I’m not sure where the extra information is getting tacked on at, but if you echo the $message variable inside of CProfileLogRoute::displaySummary(), you can see that the profiling block names now have extra information added to them, causing them to no longer match.

Outputing the $message variable from CProfileLogRoute::displaySummary() gives the following information:


begin:controllerInit in /var/www/host/framework/yiilite.php (225) in /var/www/host/protected/components/ExtendedController.php (13) in /var/www/host/protected/components/ExtendedWebApplication.php (12)


end:controllerInit in /var/www/host/framework/yiilite.php (229) in /var/www/host/protected/components/ExtendedController.php (15) in /var/www/host/protected/components/ExtendedWebApplication.php (12)

Thanks for helping investigate the issue. I have fixed this.