ZF-10761: Add FirePhp 'Collapsed' option for GROUP_START message type

Issue Type: Improvement Created: 2010-11-30T14:50:34.000+0000 Last Updated: 2010-12-17T10:39:04.000+0000 Status: Resolved Fix version(s): - 1.11.2 (30/Dec/10)

Reporter: Chris Strosser (cstrosser) Assignee: Christoph Dorn (cadorn) Tags: - Zend_Wildfire

Related issues: Attachments:


The option that allows users to initialize the FirePHP console with items initially collapsed is currently not available. Users who use the FirePHP extensively for debugging, and viewing a variety of data will find it difficult to maneuver through data without closing unnecessary grouped items. The addition of this feature to the Zend Framework, which most likely already exists within the FirePHPCore class (see:, makes the FirePHP interface more usable in the context of ZF.

(Not sure I have permissions to upload, so here is the patch - inline.)

<pre class="highlight">
Index: library/Zend/Wildfire/Plugin/FirePhp.php
--- library/Zend/Wildfire/Plugin/FirePhp.php    (revision 23462)
+++ library/Zend/Wildfire/Plugin/FirePhp.php    (working copy)
@@ -322,12 +322,13 @@
      * Starts a group in the Firebug Console
-     * @param string $title The title of the group
+     * @param  string  $title    The title of the group
+     * @param  array   $options  OPTIONAL Setting 'Collapsed' to true will initialize group collapsed instead of expanded
      * @return TRUE if the group instruction was added to the response headers or buffered.
-    public static function group($title)
+    public static function group($title, $options = array())
-        return self::send(null, $title, self::GROUP_START);
+        return self::send(null, $title, self::GROUP_START, $options);
@@ -487,7 +488,13 @@
+        if ($meta['Type'] == self::GROUP_START) {
+            if (isset($options['Collapsed']) && $options['Collapsed']) {
+                $meta['Collapsed'] = 'true';
+            }
+        }
         if ($meta['Type'] == self::DUMP) {
           return $firephp->_recordMessage(self::STRUCTURE_URI_DUMP,

<pre class="highlight">
Index: tests/Zend/Wildfire/WildfireTest.php
--- tests/Zend/Wildfire/WildfireTest.php    (revision 23462)
+++ tests/Zend/Wildfire/WildfireTest.php    (working copy)
@@ -604,7 +604,28 @@
+    public function testMessageGroupsWithCollapsedOption()
+    {
+        $this->_setupWithFrontController();
+        Zend_Wildfire_Plugin_FirePhp::group('Test Group', array('Collapsed' => true));
+        Zend_Wildfire_Plugin_FirePhp::send('Test Message');
+        Zend_Wildfire_Plugin_FirePhp::groupEnd();
+        $this->_controller->dispatch();
+        $headers = array();
+        $headers['X-Wf-Protocol-1'] = '<a href=""></a>';
+        $headers['X-Wf-1-Structure-1'] = '<a href="">…</a>';
+        $headers['X-Wf-1-Plugin-1'] = '<a href="">…</a>';
+        $headers['X-Wf-1-1-1-1'] = '69|[{"Type":"GROUP_START","Label":"Test Group","Collapsed":"true"},null]|';
+        $headers['X-Wf-1-1-1-2'] = '31|[{"Type":"LOG"},"Test Message"]|';
+        $headers['X-Wf-1-1-1-3'] = '27|[{"Type":"GROUP_END"},null]|';
+        $this->assertTrue($this->_response->verifyHeaders($headers));
+    }
     public function testMessageComparison()
         $label = 'Message';


Posted by Ramon Henrique Ornelas (ramon) on 2010-12-01T00:27:06.000+0000

This patch break BC should be used func_get_arg(s).

Posted by Chris Strosser (cstrosser) on 2010-12-01T08:38:55.000+0000

In what way does it break BC? We are only adding a parameter to group(), which shouldn't affect anything b/c the original function only uses one parameter, $title. What are you seeing?

Posted by Christoph Dorn (cadorn) on 2010-12-02T12:09:30.000+0000

This patch should be fine. We'll need a unit test as well that verifies the header output with the option set.

Posted by Chris Strosser (cstrosser) on 2010-12-03T08:21:15.000+0000

Added patch for WildfireTest.php unit test.

Posted by Christoph Dorn (cadorn) on 2010-12-03T08:37:17.000+0000

looks good to me. Have not tested. Thanks!

These patches can be applied by anyone. I'll try and get to it next week.

Posted by Christoph Dorn (cadorn) on 2010-12-17T10:38:11.000+0000


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.