[patch #5733] Ugly patch for lang.php to prevent it crashing when shmop features are not enabled in php

Pascal Vilarem <[email protected]> Fri, 09 Feb 2007 21:33:13 +0000
Newsgroups gmane.comp.web.phpgroupware.tracker
Message-ID <[email protected]>
URL:
  <http://savannah.gnu.org/patch/?5733>

                 Summary: Ugly patch for lang.php to prevent it crashing when
shmop features are not enabled in php
                 Project: phpGroupWare
            Submitted by: maat
            Submitted on: vendredi 09.02.2007 à 22:33
                Category: API - Setup
                Priority: 5 - Normal
              Item Group: CVS HEAD (aka development code base)
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

In fact i think a good way to prevent this would be to make these checks in
shm class constructor shm() and then use something like : if (
$GLOBALS['phpgw']->shm->enabled ) { blah blah...

But this would be rather heavy to do... so i submit this tiny patch allowing
setup to go on even if shmop is not available.

Notice : If shmop is not available the code crashes silently in
class.shm.inc.php because of the @ before shmod_open line 217 : if(!$id =
@shmop_open($key, "a", 0644, 100))

here is the patch :

Index: lang.php
===================================================================
RCS file: /sources/phpgroupware/setup/lang.php,v
retrieving revision 1.56
diff -u -r1.56 lang.php
--- lang.php	2 Nov 2006 09:56:58 -0000	1.56
+++ lang.php	9 Feb 2007 21:17:18 -0000
@@ -89,7 +89,7 @@
 			foreach($lang_selected as $lang)
 			{
 				//echo '<br />Working on: ' . $lang;
-				if(function_exists('sem_get'))
+				if(function_exists('sem_get') && function_exists('shmop_open') )
 				{
 					$GLOBALS['phpgw']->shm->delete_key('lang_' . $lang);
 				}





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?5733>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/