[dev] (no subject)

Tyler Colbert tyler-hordeml at colberts.us
Thu Aug 28 21:38:13 PDT 2003


Two small problems came to light when I tried to activate the signup code.

1) lib/Signup.php - If you dont have $info['extra'], you get an error on line
120 when the code tries to mergeArray with it.  Attached patch to Signup.php
checks for empty($info['extra']) before merging with it.

2) lib/Category/sql.php puts Auth::getAuth() into the insert sql statement.  But
on queuing a signup, Auth::getAuth() returns FALSE.  with pgsql that results in
an error assigning a bool to a varchar field.  The attached patch puts an empty
string in if (empty(Auth::getAuth())).

--
Tyler Colbert
-------------- next part --------------
--- Signup.php.orig	Fri Aug  8 08:28:32 2003
+++ Signup.php	Thu Aug 28 21:14:37 2003
@@ -117,10 +117,14 @@
             return PEAR::raiseError(sprintf(_("Username '%s' already exists."), $info['user_name']));
         }
         $signup = $this->newSignup($info['user_name']);
-        $signup->data = array_merge($info['extra'],
-                                    array('password' => $info['password']),
-                                    array('dateReceived' => time()));
-
+        if (!empty($info['extra'])) {
+            $signup->data = array_merge($info['extra'],
+                                        array('password' => $info['password']),
+                                        array('dateReceived' => time()));
+        } else {
+            $signup->data = array_merge(array('password' => $info['password']),
+                                        array('dateReceived' => time()));
+        }
         Horde::callHook('_horde_hook_signup_queued',
                         array($info['user_name'], $info));
         return $this->_signup->addCategory($signup);
-------------- next part --------------
Index: sql.php
===================================================================
RCS file: /repository/horde/lib/Category/sql.php,v
retrieving revision 1.84
diff -u -r1.84 sql.php
--- sql.php	13 Jul 2003 13:26:09 -0000	1.84
+++ sql.php	29 Aug 2003 03:41:51 -0000
@@ -286,6 +286,12 @@
             return PEAR::raiseError(_("Already exists"));
         }
 
+        $auth = Auth::getAuth();
+        if (empty($auth)) {
+            $authString = '';
+        } else {
+	    $authString = $auth;
+        }
         $query = sprintf('INSERT INTO %s (category_id, group_uid, category_name, category_order, category_data, user_uid, category_serialized, category_parents)' .
                          ' VALUES (%s, %s, %s, %s, %s, %s, %s, %s)',
                          $this->_params['table'],
@@ -294,7 +300,7 @@
                          $this->_db->quote(String::convertCharset($name, NLS::getCharset(), $this->_params['charset'])),
                          is_null($order) ? 'NULL' : (int)$order,
                          $this->_db->quote($data),
-                         $this->_db->quote(Auth::getAuth()),
+                         $this->_db->quote($authString),
                          (int)$ser,
                          $this->_db->quote($parents));
 


More information about the dev mailing list