Title: Plugin&#8217;s setting a null time zone, changes PHP/Server configuration?
Last modified: April 18, 2023

---

# Plugin’s setting a null time zone, changes PHP/Server configuration?

 *  Resolved [ziegel](https://wordpress.org/support/users/ziegel/)
 * (@ziegel)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/plugins-setting-a-null-time-zone-changes-php-server-configuration/)
 * 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:
 *     ```wp-block-code
       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 3 years, 1 month ago by [ziegel](https://wordpress.org/support/users/ziegel/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [ziegel](https://wordpress.org/support/users/ziegel/)
 * (@ziegel)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/plugins-setting-a-null-time-zone-changes-php-server-configuration/#post-16666194)
 * removed this comment.
    -  This reply was modified 3 years, 1 month ago by [ziegel](https://wordpress.org/support/users/ziegel/).
 *  Thread Starter [ziegel](https://wordpress.org/support/users/ziegel/)
 * (@ziegel)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/plugins-setting-a-null-time-zone-changes-php-server-configuration/#post-16666508)
 * 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](https://wordpress.org/support/users/ziegel/)
 * (@ziegel)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/plugins-setting-a-null-time-zone-changes-php-server-configuration/#post-16666711)
 * 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](https://wordpress.org/support/users/ziegel/)
 * (@ziegel)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/plugins-setting-a-null-time-zone-changes-php-server-configuration/#post-16666729)
 * I’m checking of this is kind of a syslog issue
    -  This reply was modified 3 years, 1 month ago by [ziegel](https://wordpress.org/support/users/ziegel/).
 *  Thread Starter [ziegel](https://wordpress.org/support/users/ziegel/)
 * (@ziegel)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/plugins-setting-a-null-time-zone-changes-php-server-configuration/#post-16667055)
 * 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()](http://php.net/manual/en/function.gmdate.php)
 * 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('My``ontinenet`/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 3 years, 1 month ago by [ziegel](https://wordpress.org/support/users/ziegel/).
 *  Plugin Author [Delicious Brains](https://wordpress.org/support/users/deliciousbrains/)
 * (@deliciousbrains)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/plugins-setting-a-null-time-zone-changes-php-server-configuration/#post-16671569)
 * 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.

 * ![](https://ps.w.org/wp-ses/assets/icon-256x256.jpg?rev=2070048)
 * [WP Offload SES Lite](https://wordpress.org/plugins/wp-ses/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-ses/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-ses/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-ses/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-ses/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-ses/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Delicious Brains](https://wordpress.org/support/users/deliciousbrains/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/plugins-setting-a-null-time-zone-changes-php-server-configuration/#post-16671569)
 * Status: resolved