[dev] Fatal error: Cannot use object of type PEAR_Error as array in horde/config/hooks.php

Andre Pawlowski sqall at h4des.org
Tue Dec 16 11:50:03 UTC 2008


Hi guys.

I've activated the $conf[signup][queue] to get a mail when someone  
signs up to horde. So I have uncommented the example in the hooks.php  
of horde because it does what I want. When someone tries to sign up he  
gets this error:

Fatal error: Cannot use object of type PEAR_Error as array in  
/var/www/h4des.org_ssl/www/horde/config/hooks.php on line 264

The line 264 is this line of code:

$field = isset($fields[$field]['label']) ? $fields[$field]['label'] : $field;

When I comment it out it works fine. I have searched for this error  
but didn't find anything. Is it a bug in the code? Can you tell me  
something to this error?



Here I post the whole code I uncommented to get a mail notification:

  if (!function_exists('_horde_hook_signup_queued')) {
      function _horde_hook_signup_queued_walkdata($fields, $data)
      {
          $msg = '';
          foreach ($data as $field => $value) {
              if ($field == 'password' || $field == 'url') {
                  continue;
              }

              if (is_array($value)) {
                  $msg .= _horde_hook_signup_queued_walkdata($fields, $value);
              } else {
                  $field = isset($fields[$field]['label']) ?
                           $fields[$field]['label'] : $field;
                  $msg .= "$field: $value\n";
              }
          }
          return $msg;
      }

      function _horde_hook_signup_queued($userID, $data)
      {
          require_once 'Mail.php';
          global $conf, $registry;

          $headers = array(
              'To'      => $_SERVER['SERVER_ADMIN'],
              'From'    => $_SERVER['SERVER_ADMIN'],
              'Subject' => 'New ' . $registry->get('name', 'horde') . ' Signup'
          );

          $extraFields = Horde::callHook('_horde_hook_signup_getextra');

          $msg  = _("A new signup has been received and is awaiting  
your approval.");
          $msg .= "\n\n";
          $msg .= _horde_hook_signup_queued_walkdata($extraFields, $data);
          $msg .= "\n";
          $msg .= sprintf(_("You can approve this signup at %s"),  
Horde::applicationUrl('admin/user.php', true, -1));

          $mailer = Mail::factory($conf['mailer']['type'],  
$conf['mailer']['params']);
          return $mailer->send($_SERVER['SERVER_ADMIN'], $headers, $msg);
      }
  }


-- 
[] Andre Pawlowski

visit http://h4des.org






More information about the dev mailing list