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 "Knut Urdalen (JIRA)" <ji...@apache.org> on 2009/04/29 22:47:30 UTC

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

     [ 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.