Log win

From: Date: Fri, 21 Nov 2003 14:46:03 +0000
Subject: Log win
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-23796@lists.php.net to get a copy of this message
Hi, When using PEAR::Log win logger i kept having 'unterminated string literal' errors. That is because the output was win.document.writeln('<tr align=\"left\" valign=\"top\"><td>.99</td><td>PEAR</td><td>Notice</td><td style=\"color: indigo\">PHP notice in file \"c:\\php\\pear\\DB\\NestedSet.php\" on line 2013 : Undefined index: id</td></tr>'); The line break after the line number colon was breaking Javascript execution. Changing the nl2br call in the log method of Log_Win by a regex fixes the issue. Diff as follows
--- C:\php\PEAR\Log\win.php.orig.php    2003-11-21 15:44:49.000000000 +0100
+++ C:\php\PEAR\Log\win.php     2003-11-21 15:44:26.000000000 +0100
@@ -224,7 +224,7 @@
         }
         $line .= '<td>' . ucfirst($this->priorityToString($priority)) . '</td>';
         $line .= sprintf('<td style="color: %s">%s</td>',
-                         $this->_colors[$priority], nl2br($message));
+                         $this->_colors[$priority], preg_replace('/[\n|\r\n|\r]/', '<br />', $message));
         $line .= '</tr>';
         $this->_writeln($line);


« previous php.pear.dev (#23796) next »