I have a view trying to pull recent comments from all node types

However im getting this error from the subscriptions module

Debug Error: modules/subscriptions/subscriptions.module line 545 - Cannot use object of type stdClass as array

// $Id: subscriptions.module,v 1.38.2.3.2.17 2006/11/05 15:05:44 c0c0c0 Exp $

Looks like is_null is failing becuase you're referencing a member of an object, use is_object instead

--- subscriptions.module        2007-07-19 10:54:36.000000000 +1000
+++ subscriptions.module.fixed  2007-07-19 10:57:39.000000000 +1000
@@ -542,13 +542,14 @@
   $strsent = '!';
   // $comment can be an object or an array.
   // frankly, not sure why, but it may have to do with php version
-  $nid = is_null($comment->nid) ? $comment['nid'] : $comment->nid;
+  $nid = is_object($comment) ? $comment->nid :  $comment['nid'];
+
   if ($op == 'insert' || ($op == 'update' && $comment->status == 1)) { // ignore deactivated comments
     //  if use_cron is set, insert node actions into holding table
     if(variable_get('subscriptions_usecron', 0)){
       subscriptions_hold( $comment, 'comment' , $op, $user->uid );
     } else {  // if cron is not used
-      $cid = is_null($comment->cid) ? $comment['cid'] : $comment->cid;
+      $cid = is_object($comment) ? $comment->cid :  $comment['cid'];
       $nobj = node_load($nid);
       // send node subscriptions
       $strsent = $strsent . subscriptions_mailvars($nid, $cid, $user->uid, 'node', $strsent);
CommentFileSizeAuthor
sub.patch1.03 KBdgtlmoon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patchak’s picture

This problem just *appeared* on my drupal 4.7 site, which is really weird, cause it never did that before and It's beel like a year since I touched that site! So you think that maybe the modification of the php version would have something to do with that??

Thanks

dgtlmoon’s picture

yes this is definately possible as they handle the casting different