anewt-developers team mailing list archive
-
anewt-developers team
-
Mailing list archive
-
Message #00268
[Branch ~uws/anewt/anewt.uws] Rev 1786: [logging] Disable AnewtLogHandlerFirePHP for IE
------------------------------------------------------------
revno: 1786
committer: Wouter Bolsterlee <uws@xxxxxxxxx>
branch nick: anewt
timestamp: Sat 2010-10-02 14:46:12 +0200
message:
[logging] Disable AnewtLogHandlerFirePHP for IE
The handler does not do anything anymore if Internet
Explorer is detected, since:
- IE refuses to display the output if the size of HTTP
response headers is too large (which quite often happens
with many log messages) without showing any sensible error
message; and
- there is no FirePHP plugin for IE anyway so sending the
headers is useless.
modified:
logging/loghandlers.lib.php
--
lp:anewt
https://code.launchpad.net/~uws/anewt/anewt.uws
Your team Anewt developers is subscribed to branch lp:anewt.
To unsubscribe from this branch go to https://code.launchpad.net/~uws/anewt/anewt.uws/+edit-subscription
=== modified file 'logging/loghandlers.lib.php'
--- logging/loghandlers.lib.php 2010-10-02 12:42:23 +0000
+++ logging/loghandlers.lib.php 2010-10-02 12:46:12 +0000
@@ -273,6 +273,12 @@
* Note that this log handler only works if no response body has been sent yet.
* The standard headers_sent() function is used to detect this. If the headers
* are already sent, all log messages will be silently discarded.
+ *
+ * This handler does not do anything if Internet Explorer is detected, since:
+ * - IE refuses to display the output if the size of HTTP response headers is
+ * too large (which quite often happens with many log messages) without
+ * showing any sensible error message; and
+ * - there is no FirePHP plugin for IE anyway so sending the headers is useless.
*/
final class AnewtLogHandlerFirePHP extends AnewtLogHandlerBase
{
@@ -283,11 +289,21 @@
*/
private $n_messages = 0;
+ /**
+ * Whether the log handler is enabled.
+ */
+ private $enabled = true;
+
function __construct()
{
if (headers_sent())
return;
+ /* Disable the handler if IE is detected */
+ $user_agent = array_get_default($_SERVER, 'HTTP_USER_AGENT');
+ if ($user_agent && str_contains($user_agent, ' MSIE '))
+ $this->enabled = false;
+
/* Send the headers needed for initialization */
header('X-Wf-Protocol-1: http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
header('X-Wf-1-Structure-1: http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
@@ -296,7 +312,7 @@
function log($domain, $level, $message)
{
- if (headers_sent())
+ if (!$this->enabled || headers_sent())
return;
assert('is_int($level)');