Closed (fixed)
Project:
Activity Log
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Jul 2011 at 21:01 UTC
Updated:
28 May 2012 at 16:30 UTC
After having saved an Activity Log rule ("Log activity for the acting user") with the CCK token for an imagefield ([node:field_image-filefield-view]) I get the following warning:
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /Users/thomascermak 2/Sites/log/includes/database.mysql.inc on line 329.
Also, activity logs for any content type that contain the CCK imagefield will not display in the "activities" (activity log) view as long as their rule contains the mentioned imagefield token. I will test to see if I can duplicate this with other tokens today.
Comments
Comment #1
icecreamyou commentedCan you put this code before line 329 in database.mysql.inc so we can see what is triggering that error?
Comment #2
pribeh commentedArray ( [web] => web ) is what gets printed. I'm not sure what's up but to be even clearer I'm getting this after saving any default Activity Log rule regardless whether I change it. So, if I save a pre-existing rule without making any changes I get the same result (with both vanilla and non-vanilla setups).
Comment #3
icecreamyou commentedInteresting. Line 419 of activity_log.rules.inc should be this:
'display_type' => $v['display_type'],
Try changing it to this:
'display_type' => reset($v['display_type']),
I think that should make new Rules work but it might cause other problems with default Rules. But it's mysterious why the display type would be an array -- its value comes from a select list which should only return a single value.
Comment #4
pribeh commentedSeems to fix this issue at least. Lets' hope it won't cause too many other ones.
Comment #5
pribeh commentedWait a sec. I'm still getting the same warning every time I try to flush the cache (after having changed the respective lines you mentioned). Also:
- whenever I flush the activity log cache the logs for nodes (probably those rules that I've resaved) disappear. Plus, I get the same warning.
- then, if I try to regenerate the activity log I get the following:
- However, the activity log view still does not show the node logs. Clearing cache again does not change this.
- then, as soon as I resave one of the elements of the rule for the activity log for nodes returns (is displayed within the activity log view).
Comment #6
pribeh commentedWhenever attempting to save an Activity Log rule ("Log activity when a node is created") using the latest August 6th dev of Activity Log, on a vanilla Drupal install, I get the following warning:
mysql_real_escape_string() expects parameter 1 to be string, array given in /Users/thomascermak 2/Sites/log/includes/database.mysql.inc on line 333.Along with:
Array ( [web] => web )I also can't get it to display CCK file tokens after adding them. I'm experiencing pretty much the same symptoms.
Comment #7
pribeh commentedHmm, I'm not experiencing any of the bugs I'm reporting here running Activity Log within the very latest beta of Drupal Commons out of the box. I'm going to copy over the entire module suite from Drupal Commons into a vanilla site, turn on all the modules that come switched on with Drupal Commons install, see if that gets rid of the errors, then turn them off one by one to see if this is related to an undeclared dependency.
Comment #8
icecreamyou commentedWell your error about call_user_func_array() is almost certainly related to an accidental dependency. However I'm really not sure why that would still come up since there should be code that checks for those situations.
The particular error this issue is about is much more mysterious. You should be getting a string; that's what a "select" form element returns. I'm not sure why it would be happening.
Comment #9
pribeh commentedWell, I have a dilema. I'm not sure the mysql.inc on line 333 is actually caused by a CCK token inserted into a Activity Log rule. I get it trying to clear the cache no matter what. I don't seem to get this warning anywhere else anymore though.
Comment #10
icecreamyou commentedClearing which cache? Just the general Drupal cache or the "Clear all message caches" button at admin/settings/activity_log?
Comment #11
pribeh commentedJust the Activity Log cache.
Comment #12
icecreamyou commentedHmm, well this is with your custom rule though right? So it would be the same problem as when creating the rule -- it's expecting a string and getting an array. Still not sure why that would occur.
Comment #13
pribeh commentedHi Ice, I think there might be some sort of dependency on Organic Groups. I'll try to give it another go today, but I've been trying to duplicate Commons' module setup and configuration to try and isolate any dependency. Twice now, I've removed this warning and resolved the regeneration issue by not simply switching on OG but actually setting up a base OG node type ("group").
Comment #14
icecreamyou commentedIs this still a problem? And is #1247490: Regeneration of Rules "with" Custom CCK Token Broken the same issue?
Comment #15
pribeh commentedLet's close this. I'm not experiencing this anymore.
Comment #17
adixb commentedI can confirm that the 'reset' line fixed a problem I encountered when using facebook_status (fbss) module. That module creates some custom rules which were not working until I added this fix.
Comment #18
eidoscomI added
to the function _activity_log_rebuild_templates() before the construction of $record array and all the errors gone out. Never more shows the warnings and the activity logs stop desapearing on the activities page.
The desapearing issue is because if try to update the database when 'display_type' is an array, the default value 'web' doesn't stores to the database. On views, the default query is using " 'display_type = 'web' ", so a blank value causes no selection of the activity message.
It's not the solution, but let me work without alerts/warnings and is working.