ZF-4019: Zend_Db_Profiler_Firebug with multiple databases


My page is connected with multiples databases. I activate Zend_Db_Profiler_Firebug as profiler for each one. I enable it for each one. But I only receive the table in Firebug for the first registered database.


Scheduling for RC3

This is not OK :). You try to register multiple times the Plugin (apparently for each db). This code functions:

 * Register this object as a controller plugin.
 * @return void
protected function _registerControllerPlugin()
    static $already_made = false;
    $controller = Zend_Controller_Front::getInstance();
    try {
        if (!$already_made) {
            $controller->registerPlugin($this, self::$_controllerPluginStackIndex);
    } catch (Zend_Controller_Exception $e) {
        // Exception indicates plugin is already registered
        // which we simply ignore

Is it displaying a log entry for each DB? It does work for me. Also see the Zend_Wildfire demo.

While the code calls $controller->registerPlugin repeatedly it is in fact only registered once as the registerPlugin() method throws an exception if the plugin is already registered.

I guess the way I am doing it at the moment is no the "clean" way. Rather than keeping a flag in my code I would prefer to call a method on Zend_Controller_Front called isPluginRegistered().

Let's open a new issue for this if the multiple DB logging is working as intended.

My problem is with Zend_Db_Profiler_Firebug not with Zend_Log_Writer_Firebug, is that your question?

Without my code, I have nothing in Firebug. With my code, I have the 2 tables in Firebug. Is my response correct?

I understand: I have xDebug which catch the exception before your try/catch.

I should not rely on the exception for control flow. I'll work on a fix. It will probably not make it into 1.6.0, but will be in 1.6.1

The issue is resolved other than when xDebug is installed.

Fixed with:

    protected function _registerControllerPlugin()
        $controller = Zend_Controller_Front::getInstance();
        if (!$controller->hasPlugin(get_class($this))) {
            $controller->registerPlugin($this, self::$_controllerPluginStackIndex);

Updating for the 1.6.0 release.