12
votes

I have found a bug after the upgrading the Wordpress to the last version of the software 3.9.

I get this error:

Thu Apr 17 17:21:52 2014] [warn] mod_fcgid: stderr: PHP Catchable fatal error: Object of class WP_Post could not be converted to string in /wp-content/plugins/qtranslate/qtranslate_core.php on line 455, referer: http://www.mywebsite.com/

Why do this happen?

4
What's the code on the line mentioned? If you don't have any luck on here, try wordpress.stackexchange.com which might suite better for any wordpress related dev question. - Daniel W.
Why not file a bug with the author of the plugin? It's obvious that the issue is with plugin not working with 3.9. Perhaps wait for a fix from them? - dotty
@DanFromGermany I don't know the website wordpress.stackexchange.com ... however thanks - Michelangelo

4 Answers

48
votes

Solved!!

You have to remove the "$before." in qtranslate_core.php file from the last line, qtranslate works here with WP 3.9 !

so the result must be:

return strftime($format, $date).$after;

We will wait the qTranslate upgrade!

thanks

4
votes

I wanted to add my 2 cents after investigating this issue myself. I don't like to ever hack the core of WP or the plugins. When I got the error indicated by the author of this thread, I fixed it by going into Settings -> Languages and clicking the Advanced Settings tab.

Under the Date / Time Conversion section it was set to the first option Use emulated date function. I changed it to Use strftime instead of date. and voila, no more error and no hacking the core!

Report back if this worked for you or if you had any issues.

Wordpress: v3.9.1 qTranslate: v2.5.39

1
votes

For me (WP 4.1.1, qTranslate 2.5.39) the following helped:

  1. From the dashboard, go to Plugins > qTranslate > Settings
  2. Click the "Advanced Settings" link
  3. In the "Date / Time Conversion" settings group select "Use strftime instead of date and replace formats with the predefined formats for each language." (was set to "Use strftime instead of date").

Voila!

0
votes

Unfortunately all above didn't work for me, but I found another solution, which helped me solve that issue:

in file qtranslate_core.php you must change this line

function qtrans_dateFromPostForCurrentLanguage($old_date, $format ='', $before = '', $after = '') {

to

function qtrans_dateFromPostForCurrentLanguage($old_date, $format ='') {

and this line

return qtrans_strftime(qtrans_convertDateFormat($format), mysql2date('U',$post->post_date), $old_date, $before, $after);

to

return qtrans_strftime(qtrans_convertDateFormat($format), mysql2date('U',$post->post_date), $old_date);