Author: Kris.Wallsmith
Date: 2010-08-31 15:23:50 +0200 (Tue, 31 Aug 2010)
New Revision: 30790

Added:
   branches/1.3/test/unit/log/sfWebDebugLoggerTest.php
   branches/1.4/test/unit/log/sfWebDebugLoggerTest.php
Modified:
   branches/1.3/lib/log/sfWebDebugLogger.class.php
   branches/1.4/lib/log/sfWebDebugLogger.class.php
Log:
[1.3, 1.4] fixed logging of PHP errors to the WDT when error messages include a 
"%" character


Modified: branches/1.3/lib/log/sfWebDebugLogger.class.php
===================================================================
--- branches/1.3/lib/log/sfWebDebugLogger.class.php     2010-08-31 07:22:48 UTC 
(rev 30789)
+++ branches/1.3/lib/log/sfWebDebugLogger.class.php     2010-08-31 13:23:50 UTC 
(rev 30790)
@@ -82,7 +82,7 @@
       return false;
     }
 
-    $message = sprintf(' %%s at %s on line %s (%s)', $errfile, $errline, 
$errstr);
+    $message = sprintf(' %%s at %s on line %s (%s)', $errfile, $errline, 
str_replace('%', '%%', $errstr));
     switch ($errno)
     {
       case E_STRICT:

Added: branches/1.3/test/unit/log/sfWebDebugLoggerTest.php
===================================================================
--- branches/1.3/test/unit/log/sfWebDebugLoggerTest.php                         
(rev 0)
+++ branches/1.3/test/unit/log/sfWebDebugLoggerTest.php 2010-08-31 13:23:50 UTC 
(rev 30790)
@@ -0,0 +1,25 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) Fabien Potencier <[email protected]>
+ * 
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+require_once dirname(__FILE__).'/../../bootstrap/unit.php';
+require_once dirname(__FILE__).'/../sfContextMock.class.php';
+
+$t = new lime_test(1);
+
+$context = sfContext::getInstance(array());
+$dispatcher = new sfEventDispatcher();
+$logger = new sfWebDebugLogger($dispatcher);
+
+// ->handlePhpError()
+$t->diag('->handlePhpError()');
+
+$error = error_get_last();
+$logger->handlePhpError(E_NOTICE, '%', __FILE__, __LINE__);
+$t->is_deeply(error_get_last(), $error, '->handlePhpError() works when message 
has a "%" character');

Modified: branches/1.4/lib/log/sfWebDebugLogger.class.php
===================================================================
--- branches/1.4/lib/log/sfWebDebugLogger.class.php     2010-08-31 07:22:48 UTC 
(rev 30789)
+++ branches/1.4/lib/log/sfWebDebugLogger.class.php     2010-08-31 13:23:50 UTC 
(rev 30790)
@@ -82,7 +82,7 @@
       return false;
     }
 
-    $message = sprintf(' %%s at %s on line %s (%s)', $errfile, $errline, 
$errstr);
+    $message = sprintf(' %%s at %s on line %s (%s)', $errfile, $errline, 
str_replace('%', '%%', $errstr));
     switch ($errno)
     {
       case E_STRICT:

Added: branches/1.4/test/unit/log/sfWebDebugLoggerTest.php
===================================================================
--- branches/1.4/test/unit/log/sfWebDebugLoggerTest.php                         
(rev 0)
+++ branches/1.4/test/unit/log/sfWebDebugLoggerTest.php 2010-08-31 13:23:50 UTC 
(rev 30790)
@@ -0,0 +1,25 @@
+<?php
+
+/*
+ * This file is part of the symfony package.
+ * (c) Fabien Potencier <[email protected]>
+ * 
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+require_once dirname(__FILE__).'/../../bootstrap/unit.php';
+require_once dirname(__FILE__).'/../sfContextMock.class.php';
+
+$t = new lime_test(1);
+
+$context = sfContext::getInstance(array());
+$dispatcher = new sfEventDispatcher();
+$logger = new sfWebDebugLogger($dispatcher);
+
+// ->handlePhpError()
+$t->diag('->handlePhpError()');
+
+$error = error_get_last();
+$logger->handlePhpError(E_NOTICE, '%', __FILE__, __LINE__);
+$t->is_deeply(error_get_last(), $error, '->handlePhpError() works when message 
has a "%" character');

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to