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

Jan Schneider jan at horde.org
Wed Dec 17 23:52:04 UTC 2008


Zitat von Andre Pawlowski <sqall at h4des.org>:

> 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;

$fields[$field] is obviously a PEAR_Error. Dump $fields at the top of  
the method to see what the error message is.

> 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
>
>
>
>
>
> --
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>



Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list