12

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?

3
  • 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.
    Commented Apr 17, 2014 at 15:42
  • 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
    Commented Apr 17, 2014 at 15:44
  • @DanFromGermany I don't know the website wordpress.stackexchange.com ... however thanks Commented Apr 17, 2014 at 20:40

4 Answers 4

48

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
  • 2
    On my plugin, it was the last line of the qtrans_strftime function.
    – djjeck
    Commented Apr 20, 2014 at 17:08
  • 2
    return $before.strftime($format, $date).$after; => return strftime($format, $date).$after; Commented May 8, 2014 at 8:51
  • Works with 4.1.1 too.
    – Simon
    Commented Mar 7, 2015 at 21:49
  • 1
    Nice. Works with 4.4.1 too.
    – MazarD
    Commented Jan 14, 2016 at 20:18
3

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

4
  • 3
    Unfortunately this didn't work for me. I tried all the options but had to resort to the hack Commented May 30, 2014 at 21:25
  • Interesting! For science, how are you calling the date in the offending page? I only got this bug when displaying the date. I'm using <?php print get_the_date(); ?> Commented May 30, 2014 at 22:21
  • Thanks for great solution, this works superb in my case. page edit was not working. Commented Aug 26, 2017 at 8:16
  • I am also unable to edit permalinks on edit page because of this. Any help on this? Commented Aug 26, 2017 at 8:17
1

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

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);

Not the answer you're looking for? Browse other questions tagged or ask your own question.