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

List:       squirrelmail-cvs
Subject:    [SM-CVS] CVS: squirrelmail/functions i18n.php,1.129.2.48,1.129.2.49
From:       Tomas Kuliavas <tokul () users ! sourceforge ! net>
Date:       2006-04-30 4:49:36
Message-ID: E1Fa3sG-0007bH-HQ () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/squirrelmail/squirrelmail/functions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28548/functions

Modified Files:
      Tag: SM-1_4-STABLE
	i18n.php 
Log Message:
OpenBSD setlocale fix from devel. Closes 1427512


Index: i18n.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/functions/i18n.php,v
retrieving revision 1.129.2.48
retrieving revision 1.129.2.49
diff -u -w -r1.129.2.48 -r1.129.2.49
--- i18n.php	14 Apr 2006 22:27:07 -0000	1.129.2.48
+++ i18n.php	30 Apr 2006 04:49:34 -0000	1.129.2.49
@@ -37,11 +37,11 @@
  * @see http://www.php.net/setlocale
  */
 function sq_setlocale($category,$locale) {
+    if (is_string($locale)) {
     // string with only one locale
-    if (is_string($locale))
-        return setlocale($category,$locale);
-
-    if (! check_php_version(4,3)) {
+        $ret = setlocale($category,$locale);
+    } elseif (! check_php_version(4,3)) {
+        // older php version (second setlocale argument must be string)
         $ret=false;
         $index=0;
         while ( ! $ret && $index<count($locale)) {
@@ -52,6 +52,17 @@
         // php 4.3.0 or better, use entire array
         $ret=setlocale($category,$locale);
     }
+
+    /* safety checks */
+    if (preg_match("/^.*\/.*\/.*\/.*\/.*\/.*$/",$ret)) {
+        /**
+         * Welcome to We-Don't-Follow-Own-Fine-Manual department
+         * OpenBSD 3.8, 3.9-current and maybe later versions 
+         * return invalid response to setlocale command.
+         * SM bug report #1427512.
+         */
+        $ret = false;
+    }
     return $ret;
 }
 



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
--
squirrelmail-cvs mailing list
List Address: squirrelmail-cvs@lists.sourceforge.net
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
http://squirrelmail.org/cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

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