[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail:[14978] branches/SM-1_4-STABLE/squirrelmail/ functions/date.php
From:       pdontthink--- via squirrelmail-cvs <squirrelmail-cvs () lists ! sourceforge ! net>
Date:       2022-12-06 11:40:20
Message-ID: 1670326820.957709.16656 () sfp-scm-5 ! v30 ! lw ! sourceforge ! com
[Download RAW message or body]

Revision: 14978
          http://sourceforge.net/p/squirrelmail/code/14978
Author:   pdontthink
Date:     2022-12-06 11:40:20 +0000 (Tue, 06 Dec 2022)
Log Message:
-----------
Fix poorly written timezone parsing

Modified Paths:
--------------
    branches/SM-1_4-STABLE/squirrelmail/functions/date.php

Modified: branches/SM-1_4-STABLE/squirrelmail/functions/date.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/functions/date.php	2022-06-20 17:26:13 UTC \
                (rev 14977)
+++ branches/SM-1_4-STABLE/squirrelmail/functions/date.php	2022-12-06 11:40:20 UTC \
(rev 14978) @@ -81,13 +81,16 @@
             break;
     }
     $neg = false;
-    if (substr($tzc, 0, 1) == '-') {
-        $neg = true;
-    } else if (substr($tzc, 0, 1) != '+') {
-        $tzc = '+'.$tzc;
+    if (preg_match('/^([+-]?)(\d\d)(\d\d)$/', $tzc, $matches)) {
+        if ($matches[1] === '-')
+            $neg = true;
+        $hh = $matches[2];
+        $mm = $matches[3];
+    } else {
+        // anything not listed above and not in the form +0400
+        // defaults to UTC
+        $hh = $mm = 0;
     }
-    $hh = substr($tzc,1,2);
-    $mm = substr($tzc,3,2);
     $iTzc = ($hh * 60 + $mm) * 60;
     if ($neg) $iTzc = -1 * (int) $iTzc;
     /* stamp in gmt */

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.



-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
                https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic