Index: includes/actions.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/actions.inc,v
retrieving revision 1.11
diff -u -r1.11 actions.inc
--- includes/actions.inc	23 Apr 2008 18:05:57 -0000	1.11
+++ includes/actions.inc	4 Jun 2008 21:48:18 -0000
@@ -11,7 +11,7 @@
  *
  * Given the IDs of actions to perform, find out what the callbacks
  * for the actions are by querying the database. Then call each callback
- * using the function call $function($object, $context, $a1, $2)
+ * using the function call $function($object, $context, $a1, $a2)
  * where $function is the name of a function written in compliance with
  * the action specification; that is, foo($object, $context).
  *
@@ -277,19 +277,10 @@
 
   // Any actions that we have left in $actions_in_db are orphaned.
   if ($actions_in_db) {
-    $orphaned = array();
-    $placeholder = array();
-
-    foreach ($actions_in_db as $callback => $array) {
-      $orphaned[] = $callback;
-      $placeholder[] = "'%s'";
-    }
-
-    $orphans = implode(', ', $orphaned);
+    $orphaned = array_keys($actions_in_db);
 
     if ($delete_orphans) {
-      $placeholders = implode(', ', $placeholder);
-      $results = db_query("SELECT a.aid, a.description FROM {actions} a WHERE callback IN ($placeholders)", $orphaned);
+      $results = db_query("SELECT a.aid, a.description FROM {actions} a WHERE callback IN (" . db_placeholders($orphaned, 'varchar') .  ")", $orphaned);
       while ($action = db_fetch_object($results)) {
         actions_delete($action->aid);
         watchdog('actions', "Removed orphaned action '%action' from database.", array('%action' => filter_xss_admin($action->description)));
@@ -298,6 +289,7 @@
     else {
       $link = l(t('Remove orphaned actions'), 'admin/build/actions/orphan');
       $count = count($actions_in_db);
+      $orphans = implode(', ', $orphaned);
       watchdog('actions', format_plural($count, 'One orphaned action (%orphans) exists in the actions table. !link', '@count orphaned actions (%orphans) exist in the actions table. !link', array('@count' => $count, '%orphans' => $orphans, '!link' => $link), 'warning'));
     }
   }
