Index: job_queue.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/job_queue/job_queue.module,v retrieving revision 1.7 diff -u -p -r1.7 job_queue.module --- job_queue.module 18 Aug 2008 07:35:59 -0000 1.7 +++ job_queue.module 15 May 2009 08:49:54 -0000 @@ -106,7 +106,7 @@ function job_queue_dequeue() { if (function_exists($job->function)) { $arguments = unserialize($job->arguments); call_user_func_array($job->function, $arguments); - watchdog('job_queue', 'Ran queued job "!description"', array('!description' => t($job->description, $arguments))); + watchdog('job_queue', 'Ran queued job "!description"', array('!description' => t($job->description, _job_queue_t_args($arguments)))); } else { watchdog('job_queue', 'Failed to run queued job "!description" because the function %function is not defined.', array('!description' => $job->description, '%function' => $job->function), WATCHDOG_ERROR); @@ -144,7 +144,7 @@ function job_queue_list() { while ($job = db_fetch_object($result)) { $rows[] = array( format_date($job->created), - t($job->description, unserialize($job->arguments)), + t($job->description, _job_queue_t_args(unserialize($job->arguments))), ); } $output .= theme('table', $header, $rows); @@ -233,3 +233,26 @@ function job_queue_settings_form_submit( } drupal_set_message(t('Saved job queue settings.')); } + +/** + * Helper function to reduce $arguments to a valid replacement array for t(). + */ +function _job_queue_t_args($arguments = array()) { + if (!is_array($arguments)) return array(); + foreach ($arguments as $key => $arg) { + if (is_array($arg) || is_object($arg)) { + unset($arguments[$key]); + continue; + } + switch (substr($key,0,1)) { + case "!": + case "%": + case "@": + break; + default: + unset($arguments[$key]); + continue; + } + } + return $arguments; +}