• Resolved RobertBasil

    (@robertbasil)


    When trying to use the pressthis tool I get the error:

    Fatal error: Call to undefined function: htmlspecialchars_decode() in /home/content/r/o/b/robertbasil/html/wp-admin/press-this.php on line 554

    Line 554:
    <?php if ($selection) echo wp_richedit_pre(htmlspecialchars_decode($selection)); ?>

    I’m using php4, I thought this was a php5 error?

Viewing 15 replies - 1 through 15 (of 17 total)
  • if you have recently upgraded, then you may have not replaced all the files correctly – check that all files are as they should be.

    A call to an undefined function means a file is missing from wp-admin.

    Thread Starter RobertBasil

    (@robertbasil)

    This is a brand new install. All files have been uploaded. Everything else is working just fine.

    A call to an undefined function means a file is missing from wp-admin.

    You can’t rely on a “success” message from your FTP program. You need to use it bring up the files on your computer and on the server and check them for size.

    Isn’t the pressit tool from WordPress.com? If your site is hosted there, they are your support.

    A URL also makes it easier to troubleshoot.

    Thread Starter RobertBasil

    (@robertbasil)

    I have checked all of the files and sizes, all of the files are uploaded correctly. The “press this” tool is included in the wordpress.org download, this is a self hosted website. This is by far not my first wordpress install, but it is my first 2.7 install.

    A URL will not help you as you cannot use the press this tool without logging in as an admin and I’m not going to give that out.

    Robert, You should always post your URL so people can assist you properly. The problem you are having may have nothing to do with the tool. But, if you don’t want to post it, fine, your call.

    Thread Starter RobertBasil

    (@robertbasil)

    I understand that a URL normally helps for support requests, but I really don’t see how it will help with this one. Oh well, here you go anyway. Thanks for taking a look.

    The address is http://www.robertbasil.com

    You cannot duplicate the error without using the pressthis tool, and you cannot use the pressthis tool without having admin access.

    Here is what the error looks like:

    http://www.robertbasil.com/2008/12/18/problems-with-the-wp-pressthis-tool/

    I also get this error, but only if I use the “Press This” bookmarklet while some text is selected on the current web page

    I am unable to duplicate this problem. I grabbed sites, text, pictures, special characters, etc.

    Was there a particular site you were unable to use Press This?

    BTW, I like your snow.

    Thread Starter RobertBasil

    (@robertbasil)

    The error happens no matter which site I am grabbing from. Looks like alexpb11 above has the same error.

    It only happens when text is selected on the page you are visiting. If you don’t select any text it works just fine.

    Thanks. πŸ™‚

    I highlighted text then opened Press This – no error.
    I opened Press This then highlited text – no problem.

    The only difference I see between your Press This and mine is your page name or site name at the top is underlined and your path at the bottom says p. Mine says nothing there.

    Sorry I can’t help on this. Perhaps someone else will chime in here.

    Thread Starter RobertBasil

    (@robertbasil)

    Maybe it works for the upgraded blog but brand new 2.7 installs are having problems?

    I’ve tried it on Windows using IE and Firefox, and on a Mac using Firefox and Safari and all of them have the same problem.

    Thread Starter RobertBasil

    (@robertbasil)

    In looking at the error more the undefined function is htmlspecialchars_decode in the press-this.php file inside of the wp-admin.

    The htmlspecialchars_decode is a function introduced in php 5.10 and is not available (as far as I can tell) in php 4.X

    I am using php4 and WP should work using php4 so what’s going on with the htmlspecialchars_decode code?

    I’m using php4

    You might try replacing line 554 code with . . .

    <?php
    
    if ( !function_exists('htmlspecialchars_decode') )
    {
        function htmlspecialchars_decode($text)
        {
            return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
        }
    }
    
    ?>

    This is from http://us2.php.net/htmlspecialchars_decode

    A google search for htmlspecialchars_decode() : will give you a little additional information.

    Thread Starter RobertBasil

    (@robertbasil)

    I figured out a quick fix.

    Since htmlspecialchars_decode only works with php 5.10 and above I just removed that part of the code.

    In the press-this.php file on line 554 change this:

    <?php if ($selection) echo wp_richedit_pre(htmlspecialchars_decode($selection)); ?>

    To this:

    <?php if ($selection) echo wp_richedit_pre($selection); ?>

    Now it works just fine.

    The code really should do a check to see if php 5.1 is installed before calling the htmlspecialchars_decode function.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘pressthis error with 2.7’ is closed to new replies.