Warning: cannot yet handle MBCS in html_entity_decode

If you are using PHP 4 and using some of my plugins, the error message “Warning: cannot yet handle MBCS in html_entity_decode” will get displayed on your page. This is not a bug in my plugin but a bug in PHP 4 itself.

My recommendation would definitely be asking you to upgrade to PHP 5. PHP group has announced the end of life for PHP 4 on the 13th July 2007.

Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

As you can see, there would not be any more PHP 4 updates and security fixes will be available till 8th August 2008 which is only 2 more months. If you want to upgrade to PHP 5, this is the best time to do it.

If for some reasons you are not able to upgrade to PHP 5, the only thing you can do is to turn off error message display. You can refer to this thread for more information. This is definitely not an elegant solution.

If you host supports PHP 5 but you are on PHP 4, you can take a look at the solution posted by Thomas Arie Setiawan.

Softwares like MediaWiki which powered Wikipedia requires your server to be running PHP 5, and vBulletin has beginning asking customers to upgrade to PHP 5. It would be a matter of time before WordPress requires a minimum of PHP 5 to be running.

1 Star2 Stars3 Stars4 Stars5 Stars (79 votes, average: 3.73 out of 5)

13 thoughts on “Warning: cannot yet handle MBCS in html_entity_decode”

  1. Just change and make your plugins php5 only… the more folks do that, the pressure that can be brought to bear on these hosts running ancient software… we need to get php4 sunsetted… sorry, just my 2 cents…

  2. Mr Papa: Currently a few of my plugins can be used only on PHP 5 =D. Thanks for the support and voicing out =D

  3. A workaround for this error is using utf8_decode($text) instead of using the default html_entity_decode() used in the plugins.

    This would work fine only if your blog is utf8 encoded, but the error only hapens (as i could see from the php bug page) when you try to decode utf8 text, and it is default to WordPress anyway.

    eg: for the post rating plugin, replace the line 573 from wp-postratings.php from:

    $text=html_entity_decode($text,ENT_QUOTES,get_option(‘blog_charset’));

    to:

    $text = utf8_decode($text);

    Of course, you should check if the blog really is utf8 before doing so.

    Best Regards,
    Guilherme Silva, PMP
    http://www.gerenciamentoeconomico.com.br

  4. I’m curious, I totally missed where in the documentation that it requires php5. My site broke, and my hosting doesn’t provide php 5, and I can’t roll back to 1.2 for some reason, need to check a few other things. I think LC has probably the best widgets out there, and quite likely the best documented as well, so I’ll not gripe too loudly.

    I’ll admit maybe I missed something, but to say “just upgrade to php 5” is a little out of touch with reality and a bit junior. I’m a huge advocate of php 5 and it powers most of the sites i run professionally, but php5 adoption is still lagging behind.

  5. @dave: After I roll out the plugin then I realize that it is not working for PHP4 as I always develop in PHP5. PHP4 just makes life difficult for me to develop at times.

  6. PHP4 makes life difficult for a lot of people. 😉 I just gave my current blog hosting a “warning”, if no action I’ll move them over to my hosting with the rest of my PHP5 sites.

    ps – if I may be so bold, you may want to add a warning in your docs about that requirement. I googled for the error and found hundreds of sites.

  7. If you are running on a Godaddy server:

    What was the problem?

    The problem was that GoDaddy runs php version 4 and version 5 concurrently with the Linux hosting configuration 2.0 . Facebook applications only run on php version 5. When checking the version of php, the script indicates that GoDaddy is running php version 4.3.

    How to fix this?

    Well, there are a lot of proposed fixes out there. Difficult to find and GoDaddy documentation and customer service is unclear and muddled. The simple fix, include a .htaccess file in the root directory with the following line below:

    AddHandler x-httpd-php5 .php

  8. Hi all,

    My solution is quiet the same.

    -Look for the following line:

    $text = html_entity_decode($text, ENT_QUOTES, get_option(‘blog_charset’));

    -Replace the line with the following:

    $text = utf8_decode($text);

    Regards,
    Björn

  9. Thanks a lot, Housed. That fixed it the post views plugin on our site, much appreciated.

    Just need to get our host to upgrade to PHP5 now.

Comments are closed.