Hi there,

I´m trying to use Job Queue (6.x-3.0) for sending mails and when one of the arguments of the function is a stdclass (as language parameter is) you can find a lot of errors.

In order to solve this issue, you only need to modify the line 109 of job_queue.module (las stable version) with this:

watchdog('job_queue', 'Ran queued job "!description"', array('!description' => t($job->description)));

Hope this help sameone.

CommentFileSizeAuthor
#4 fix_t_scalars.patch1.45 KBdalin
#3 fix_t_scalars.patch1.46 KBemichan

Comments

everydayjones’s picture

I still get:

* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* recoverable fatal error: Object of class stdClass could not be converted to string in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 758.
* warning: preg_match() expects parameter 2 to be string, object given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.
* warning: preg_match() expects parameter 2 to be string, array given in /home/mylivepr/public_html/my_domain.com/includes/bootstrap.inc on line 761.

fgm’s picture

I suggest you try modifying the line that looks like

        t($job->description, unserialize($job->arguments)),

in job_queue_list() to:

        t($job->description),

This loses the ability to pass parameters in the description, but will typically solve that problem.

emichan’s picture

Status: Active » Needs review
StatusFileSize
new1.46 KB

Hi,
I had the same problem, so I created a patch for it.

All this does is filters non-scalar types out of the argument arrays before passing it to t().

It patches cleanly and works as expected on my test box.

Patched against latest HEAD from module root directory.

Cheers,
emichan

dalin’s picture

StatusFileSize
new1.45 KB

Elegant solution, but you are unserializing twice. Here's a working patch.

emichan’s picture

Hah,

I missed that - it was unintentional. :P thx!

sneyerst’s picture

The patch file provided by dalin solves the problem for me.

Thanks guys!

drumm’s picture

Status: Needs review » Fixed

Committed with a little code style cleanup.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.