ZF-4019: Zend_Db_Profiler_Firebug with multiple databases

Issue Type: Bug Created: 2008-08-21T02:18:20.000+0000 Last Updated: 2008-09-02T10:39:29.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Mickael Perraud (mikaelkael) Assignee: Christoph Dorn (cadorn) Tags: - Zend_Db_Profiler

Related issues: Attachments:


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.


Posted by Matthew Weier O'Phinney (matthew) on 2008-08-22T14:50:28.000+0000

Scheduling for RC3

Posted by Mickael Perraud (mikaelkael) on 2008-08-26T12:27:46.000+0000

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

<pre class="highlight">
 * 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

Posted by Christoph Dorn (cadorn) on 2008-08-26T12:45:14.000+0000

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.

Posted by Mickael Perraud (mikaelkael) on 2008-08-26T13:07:31.000+0000

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?

Posted by Mickael Perraud (mikaelkael) on 2008-08-26T13:16:17.000+0000

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

Posted by Christoph Dorn (cadorn) on 2008-08-26T13:27:25.000+0000

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

Posted by Christoph Dorn (cadorn) on 2008-08-26T13:28:15.000+0000

The issue is resolved other than when xDebug is installed.

Posted by Christoph Dorn (cadorn) on 2008-08-30T21:27:53.000+0000

Fixed with:

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

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:29.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.