You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by "Yomei Komiya (JIRA)" <ji...@apache.org> on 2008/09/07 05:57:44 UTC

[jira] Created: (LOG4PHP-18) Date pattern %d conversion is invalid.

Date pattern %d conversion is invalid.
--------------------------------------

                 Key: LOG4PHP-18
                 URL: https://issues.apache.org/jira/browse/LOG4PHP-18
             Project: Log4php
          Issue Type: Bug
         Environment: log4php r692607,
PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2,
Ubuntu 8.04 
            Reporter: Yomei Komiya


Date pattern %d conversion includes fragile regular expression and arbitrary  substitute of  ','.
So user definition pattern (%d{format}) is not converted well.

patch as follows.
---------------------------------------------------------------------------------
diff -urN log4php/helpers/LoggerPatternConverter.php log4php.new/helpers/LoggerPatternConverter.php
--- log4php/helpers/LoggerPatternConverter.php
+++ log4php.new/helpers/LoggerPatternConverter.php
@@ -289,7 +289,7 @@
     {
         $timeStamp = $event->getTimeStamp();
         $usecs = round(($timeStamp - (int)$timeStamp) * 1000);
-        $this->df = str_replace("\u", "u", ereg_replace("[^\\]u", sprintf(',%03d', $usecs), $this->df));
+        $this->df = preg_replace('/((?<!\\\\)(?:\\\\{2})*)u/', '${1}' . sprintf('%03d', $usecs), $this->df);
          
         return date($this->df, $event->getTimeStamp());

---------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (LOG4PHP-18) Date pattern %d conversion is invalid.

Posted by "Knut Urdalen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-18?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Urdalen reopened LOG4PHP-18:
---------------------------------

      Assignee: Knut Urdalen

> Date pattern %d conversion is invalid.
> --------------------------------------
>
>                 Key: LOG4PHP-18
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-18
>             Project: Log4php
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: log4php r692607,
> PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2,
> Ubuntu 8.04 
>            Reporter: Yomei Komiya
>            Assignee: Knut Urdalen
>
> Date pattern %d conversion includes fragile regular expression and arbitrary  substitute of  ','.
> So user definition pattern (%d{format}) is not converted well.
> patch as follows.
> ---------------------------------------------------------------------------------
> diff -urN log4php/helpers/LoggerPatternConverter.php log4php.new/helpers/LoggerPatternConverter.php
> --- log4php/helpers/LoggerPatternConverter.php
> +++ log4php.new/helpers/LoggerPatternConverter.php
> @@ -289,7 +289,7 @@
>      {
>          $timeStamp = $event->getTimeStamp();
>          $usecs = round(($timeStamp - (int)$timeStamp) * 1000);
> -        $this->df = str_replace("\u", "u", ereg_replace("[^\\]u", sprintf(',%03d', $usecs), $this->df));
> +        $this->df = preg_replace('/((?<!\\\\)(?:\\\\{2})*)u/', '${1}' . sprintf('%03d', $usecs), $this->df);
>           
>          return date($this->df, $event->getTimeStamp());
> ---------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (LOG4PHP-18) Date pattern %d conversion is invalid.

Posted by "Knut Urdalen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-18?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Urdalen resolved LOG4PHP-18.
---------------------------------

    Resolution: Fixed

> Date pattern %d conversion is invalid.
> --------------------------------------
>
>                 Key: LOG4PHP-18
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-18
>             Project: Log4php
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: log4php r692607,
> PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2,
> Ubuntu 8.04 
>            Reporter: Yomei Komiya
>            Assignee: Knut Urdalen
>
> Date pattern %d conversion includes fragile regular expression and arbitrary  substitute of  ','.
> So user definition pattern (%d{format}) is not converted well.
> patch as follows.
> ---------------------------------------------------------------------------------
> diff -urN log4php/helpers/LoggerPatternConverter.php log4php.new/helpers/LoggerPatternConverter.php
> --- log4php/helpers/LoggerPatternConverter.php
> +++ log4php.new/helpers/LoggerPatternConverter.php
> @@ -289,7 +289,7 @@
>      {
>          $timeStamp = $event->getTimeStamp();
>          $usecs = round(($timeStamp - (int)$timeStamp) * 1000);
> -        $this->df = str_replace("\u", "u", ereg_replace("[^\\]u", sprintf(',%03d', $usecs), $this->df));
> +        $this->df = preg_replace('/((?<!\\\\)(?:\\\\{2})*)u/', '${1}' . sprintf('%03d', $usecs), $this->df);
>           
>          return date($this->df, $event->getTimeStamp());
> ---------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LOG4PHP-18) Date pattern %d conversion is invalid.

Posted by "Yomei Komiya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4PHP-18?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yomei Komiya closed LOG4PHP-18.
-------------------------------

    Resolution: Fixed

This patch was committed at r699319. Thanks.

> Date pattern %d conversion is invalid.
> --------------------------------------
>
>                 Key: LOG4PHP-18
>                 URL: https://issues.apache.org/jira/browse/LOG4PHP-18
>             Project: Log4php
>          Issue Type: Bug
>         Environment: log4php r692607,
> PHP 5.2.4-2ubuntu5.3 with Suhosin-Patch 0.9.6.2,
> Ubuntu 8.04 
>            Reporter: Yomei Komiya
>
> Date pattern %d conversion includes fragile regular expression and arbitrary  substitute of  ','.
> So user definition pattern (%d{format}) is not converted well.
> patch as follows.
> ---------------------------------------------------------------------------------
> diff -urN log4php/helpers/LoggerPatternConverter.php log4php.new/helpers/LoggerPatternConverter.php
> --- log4php/helpers/LoggerPatternConverter.php
> +++ log4php.new/helpers/LoggerPatternConverter.php
> @@ -289,7 +289,7 @@
>      {
>          $timeStamp = $event->getTimeStamp();
>          $usecs = round(($timeStamp - (int)$timeStamp) * 1000);
> -        $this->df = str_replace("\u", "u", ereg_replace("[^\\]u", sprintf(',%03d', $usecs), $this->df));
> +        $this->df = preg_replace('/((?<!\\\\)(?:\\\\{2})*)u/', '${1}' . sprintf('%03d', $usecs), $this->df);
>           
>          return date($this->df, $event->getTimeStamp());
> ---------------------------------------------------------------------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.