PHP Warning (Invalid CRT parameters detected ) by qTranslate on WordPress

If you use qTranslate plugin with WordPress, you may see many warning message like below information on Apache and PHP with Windows OS.

qTranslate Warning: Invalid CRT parameters detected in … \wp-content\plugins\qtranslate\qtranslate_core.php on line 447

I will give you 1 method to resolve this problem if you want to remove many warning messages

How to remove warning messages

if you want to remove many warning messages, you should edit ‘… \wp-content\plugins\qtranslate\qtranslate_core.php‘ like below codes.

$search[] = '/(([^%])%4|^%4)/'; $replace[] = '${2}'.$date; // date U
$format = preg_replace($search,$replace,$format);

// Add Windows
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$format = str_replace('%P','%p',$format);
}

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

It is very easy probrem.
You cannot use ‘%P’ that format in strftime function ( PHP ) with Windows OS.
You should use ‘%p’ if you want to remove warning messages with Windows OS.

%p UPPER-CASE 'AM' or 'PM' based on the given time Example: AM for 00:31, PM for 22:23
%P lower-case 'am' or 'pm' based on the given time Example: am for 00:31, pm for 22:23

Advertisements

One thought on “PHP Warning (Invalid CRT parameters detected ) by qTranslate on WordPress

  1. It didn’t work. I modified the file as you explained above but the problem still persists.
    Here is how my code became with your suggestion:
    ________________________________________________________________
    $search[] = ‘/(([^%])%4|^%4)/’; $replace[] = ‘${2}’.$date; // date U
    $format = preg_replace($search,$replace,$format);

    // Added this code for correct the bug, but it didn’t work :(.
    if (strtoupper(substr(PHP_OS, 0, 3)) === ‘WIN’) {
    $format = str_replace(‘%P’,’%p’,$format);
    }

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

    Did I make something wrong?

    Thanks for any help.

Leave a Reply :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s