• Resolved ziegel

    (@ziegel)


    Hi,

    I have noticed that server PHP error log file, as in:

    /var/www/vhosts/example.com/logs/PHP_errors.log

    Losses its pre configured local time zone, and switches to UTC.

    Plugin uses time zone, as in Carbon.php file:

    public function __construct($time = null, $tz = null)
    
    ...
    $timezone = static::safeCreateDateTimeZone($tz);
    ...
    public static function now($tz = null)
        {
            return new static(null, $tz);
        }
    ...
    protected static function safeCreateDateTimeZone($object)
        {
            if ($object === null) {
                // Don't return null... avoid Bug #52063 in PHP <5.3.6
                return new DateTimeZone(\date_default_timezone_get());
            }
            if ($object instanceof DateTimeZone) {
                return $object;
            }
            if (\is_numeric($object)) {
                $tzName = \timezone_name_from_abbr(null, $object * 3600, \true);
    ...
    public static function createFromTimestampUTC($timestamp)
        {
            return new static('@' . $timestamp);
        }
    ...
    public function toIso8601ZuluString()
        {
            return $this->copy()->setTimezone('UTC')->format('DeliciousBrains\\WP_Offload_SES\\Y-m-d\\TH:i:s\\Z');
        }
    ...
    public function toISOString($keepOffset = \false)
        {
            if ($this->year === 0) {
                return null;
            }
            $year = $this->year < 0 || $this->year > 9999 ? ($this->year < 0 ? '-' : '+') . \str_pad(\abs($this->year), 6, '0', \STR_PAD_LEFT) : \str_pad($this->year, 4, '0', \STR_PAD_LEFT);
            $tz = $keepOffset ? $this->format('P') : 'Z';
            $date = $keepOffset ? $this : $this->copy()->setTimezone('UTC');
            return $year . $date->format('-m-d\\TH:i:s.u') . $tz;
        }
    ...
    public function toW3cString()
        {
            return $this->format(static::W3C);
        }
        /**
         * Format the instance as RFC7231
         *
         * @return string
         */
    public function toRfc7231String()
        {
            return $this->copy()->setTimezone('GMT')->format(static::RFC7231_FORMAT);
        }

    Please note: I suspect answering a specific certain condition/s, is the circumstances, that possibly brings the plugin to undesirably manipulate the PHP/Server ‘timezone‘ (PHP: date.timezone), which was pre configured by admin.

    May I ask, if it could be the WP Offload SES usage of timezone var, causes this undesired affect?

    And if so, how should it be fixed?

    • This topic was modified 1 year, 7 months ago by ziegel.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter ziegel

    (@ziegel)

    removed this comment.

    • This reply was modified 1 year, 7 months ago by ziegel.
    Thread Starter ziegel

    (@ziegel)

    Problem could also come from another email software component, as:

    /etc/psa-webmail/roundcube/php.ini

    Where time is set as:

    date.timezone = UTC

    Thread Starter ziegel

    (@ziegel)

    No, it’s not /etc/psa-webmail/roundcube/php.ini which I modified, and issue reappeared:

    Time zone is set as correct in the PHP error log, however once an email is sent and there are PHP errors associated to its generation, the timezone changes to UTC

    Can you please investigate if this issue is coming from the plugin’s code?

    Thread Starter ziegel

    (@ziegel)

    I’m checking of this is kind of a syslog issue

    • This reply was modified 1 year, 7 months ago by ziegel.
    Thread Starter ziegel

    (@ziegel)

    Issue seems to be un related to your plugin. My appologizes.

    Issue could be related to a generic WordPress file of the name:

    wp-includes/PHPMailer/PHPMailer.php

    That file uses a miserable PHP function, of the name: gmdate() 

    That functions uses UTC…

    I have replaced it with the echo date('Y-m-d H:i:s'); function (around line 928), and also placed directive: date_default_timezone_set('Myontinenet/MyCountry'); on the beginning of the file.

    This seems to have solved the PHP error log, not logging current time, but UTC time.

    I have found the problem by searching for the usage of the string error_log( on all my domain files. That is because this is the PHP function that logs error logs, and those wrong error log, came from somewhere….

    • This reply was modified 1 year, 7 months ago by ziegel.
    Plugin Author Delicious Brains

    (@deliciousbrains)

    Hey Ziegel,

    Thanks for your effort and specifically for being transparent about the conclusion. Nice to hear it wasn’t us ??

    -et

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Plugin’s setting a null time zone, changes PHP/Server configuration?’ is closed to new replies.