Browse Source

Fix idiocy, refs #152

Jordi Boggiano 13 years ago
parent
commit
957ee8d0d6
2 changed files with 48 additions and 30 deletions
  1. 24 15
      src/Monolog/Handler/ChromePHPHandler.php
  2. 24 15
      src/Monolog/Handler/FirePHPHandler.php

+ 24 - 15
src/Monolog/Handler/ChromePHPHandler.php

@@ -40,21 +40,6 @@ class ChromePHPHandler extends AbstractProcessingHandler
 
     protected static $sendHeaders = true;
 
-    /**
-     * pointer to the static sendHeaders for BC
-     */
-    protected $sendHeaders;
-
-    /**
-     * @param integer $level  The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct($level = Logger::DEBUG, $bubble = true)
-    {
-        parent::__construct($level, $bubble);
-        $this->sendHeaders =& static::$sendHeaders;
-    }
-
     /**
      * {@inheritdoc}
      */
@@ -138,4 +123,28 @@ class ChromePHPHandler extends AbstractProcessingHandler
         return !isset($_SERVER['HTTP_USER_AGENT'])
                || preg_match('{\bChrome/\d+[\.\d+]*\b}', $_SERVER['HTTP_USER_AGENT']);
     }
+
+    /**
+     * BC getter for the sendHeaders property that has been made static
+     */
+    public function __get($property)
+    {
+        if ('sendHeaders' !== $property) {
+            throw new \InvalidArgumentException('Undefined property '.$property);
+        }
+
+        return static::$sendHeaders;
+    }
+
+    /**
+     * BC setter for the sendHeaders property that has been made static
+     */
+    public function __set($property, $value)
+    {
+        if ('sendHeaders' !== $property) {
+            throw new \InvalidArgumentException('Undefined property '.$property);
+        }
+
+        static::$sendHeaders = $value;
+    }
 }

+ 24 - 15
src/Monolog/Handler/FirePHPHandler.php

@@ -53,21 +53,6 @@ class FirePHPHandler extends AbstractProcessingHandler
 
     protected static $sendHeaders = true;
 
-    /**
-     * pointer to the static sendHeaders for BC
-     */
-    protected $sendHeaders;
-
-    /**
-     * @param integer $level  The minimum logging level at which this handler will be triggered
-     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
-     */
-    public function __construct($level = Logger::DEBUG, $bubble = true)
-    {
-        parent::__construct($level, $bubble);
-        $this->sendHeaders =& static::$sendHeaders;
-    }
-
     /**
      * Base header creation function used by init headers & record headers
      *
@@ -172,4 +157,28 @@ class FirePHPHandler extends AbstractProcessingHandler
                || preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])
                || isset($_SERVER['HTTP_X_FIREPHP_VERSION']);
     }
+
+    /**
+     * BC getter for the sendHeaders property that has been made static
+     */
+    public function __get($property)
+    {
+        if ('sendHeaders' !== $property) {
+            throw new \InvalidArgumentException('Undefined property '.$property);
+        }
+
+        return static::$sendHeaders;
+    }
+
+    /**
+     * BC setter for the sendHeaders property that has been made static
+     */
+    public function __set($property, $value)
+    {
+        if ('sendHeaders' !== $property) {
+            throw new \InvalidArgumentException('Undefined property '.$property);
+        }
+
+        static::$sendHeaders = $value;
+    }
 }