Dirty and quick fix for qtranslate plugin on WordPress 3.9

This morning I upgraded some wordpress blogs, where I am also using the qtranslate plugin.
After upgrading to WordPress 3.9 the home page was broken.
Looking into the server logs I quickly found the problem:

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

I wrote to this quick and dirty patch to have the site back online. If you have a better patch please share !

Saverio

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

28 Responses to Dirty and quick fix for qtranslate plugin on WordPress 3.9

  1. Pablo says:

    Thanks Saverio

    How can I apply this patch?

  2. Pingback: Fix qTranslate with WordPress 3.9 » alexander kirk » Blog Archive

  3. Hi,

    I have posted about a better fix in my blog: Fix qTranslate with WordPress 3.9. It takes care of the root of the cause by removing the second parameter of the called function. See my post for more detailed info.

    Regards,
    Alex

  4. Hi mate,

    and thanks for your post, it helped me out to solve this issue.

    Actually, the error is complaining about line 455 and you are changing a different row. Your code does not return any error because it will never get to that line. I finally solved this issue by modifying line 455 like from:
    return $before.($format, $date).$after;
    to:
    return $before->post_content.strftime($format, $date).$after;

    Cheers

  5. Harry says:

    Hi

    Do the above fixes resolve the problem with the visual editor?

    Thanks

  6. florin says:

    THANK YOU! deliberately with capital letters ๐Ÿ™‚

  7. Sven says:

    It works! – Thank you so much!

  8. Where have I to applicate this patch?

    I’m not sure, but….

    We are talking of
    qtranslate/qtranslate_core.php
    (reach it from plugin page)

    What says picture Saverio posted:

    Line diff… only describes differences fund
    (this one) “diff –git a/wp-content/plugins/qtranslate/qtranslate_core.php b/wp-content/plugins/qtranslate/qtranslate_core.php
    index 17b4669..9ac128a 100644
    — a/wp-content/plugins/qtranslate/qtranslate_core.php
    +++ b/wp-content/plugins/qtranslate/qtranslate_core.php
    @@ -414,6 +414,7 @@ function qtrans_updateTermLibrary() {”
    only describe differences fund.

    You havo to fine line of the function:

    function qtrans_strftime($format, $date, $default = ”, $before = ”, $after = ”) {
    // don’t do anything if format is not given
    + return $default;
    if($format==”) return $default;
    // add date suffix ability (%q) to strftime
    $day = intval(ltrim(strftime(“%d”,$date),’0′));

    and copy the + line:
    ” return $default;”

  9. Angelo says:

    THANK YOU! also me deliberately with capital letters cause I’m inexpert and it solved my panic in a flash. ๐Ÿ˜€

  10. Pingback: A suggestion to fix Qtranslate problem with recently WP 3.9 update | Wocmultimedia's Blog

  11. dskim says:

    Hi.
    This is what i want.. Thank u so much…

  12. Pingback: I installed mqTranslate: the fork of qTranslate plugin compatible with WordPress 3.9 | ZioPRoTo

  13. Otto says:

    THANK YOU SO MUCH!

    quick n dirty is the way to go =)

  14. Katya says:

    Hi,

    Thank u so, so much

  15. Mata says:

    WP 3.9.1 and qTranslate 2.5.39 and qtranslate_javascript.php/qtrans_hook_on_tinyMCE in line 292

    — ed = new tinymce.Editor(id, tinyMCEPreInit.mceInit[id]);
    +++ ed = new tinymce.Editor(id, tinyMCEPreInit.mceInit[id], tinymce);

  16. Munz says:

    Thank you!!!!!!!!!

  17. Ilkka Rinne says:

    @Mata: thanks for the tip for the tinyMCE editor constructor fix! It seems we have have the visual editor working again after making the change you posted.

  18. Povilas says:

    Thank You, @Mata and @Hackeando el Genoma !
    Saved the day ๐Ÿ™‚

  19. Ben says:

    OMG @Mata WTF… thank you so much :O It works flawlessly! Yay ๐Ÿ˜€

  20. mavus says:

    Really thanks @Mata !!!!!

  21. Pingback: qTranslate Eklenti Notlarฤฑ - WP Notlarฤฑ

  22. csegyud says:

    Hi,
    I try to make it work on GoDaddy WordPress 4.0 site but the patch fails for me.
    I tried the offical fix and the dirty too. One by one and together. But no luck. ๐Ÿ™
    Any experiences with this problem on 4.0??

    Thank you

  23. KuriNaine says:

    Thank You, Hackeando el Genoma! I searched for a good solution and Your’s really works. You made my day ๐Ÿ˜€

  24. Tito says:

    Thanks on the wp 4.0.1 work too.

  25. Lou says:

    @Hackeando el Genoma thanks mate, your solution is working for me in 4.1.

    cheers

  26. Bikesh says:

    Thanks,
    It is working

Leave a Reply

Your email address will not be published. Required fields are marked *