Support » Networking WordPress » PHP Fatal error: Uncaught Error: Call to undefined function wp_kses() in /var/w

  • Hi all. I’m getting the following debug message and a white screen “critical error” when I try and access my wordpress multi install.

    This comes after an automatic update performed by the wordpress

    This is running on my own centos 6.10 and php 7.3 (I can’t update to 7.4 on this build)

    Things I’ve tried so fare:

    disable pugins via sql and by renaming the directory

    deleting the .htaccess file

    increasing the wordpress cache to 256m

    trying a manual upgrade

    The debug message I get is as follows:

    [25-Jan-2024 03:38:12 UTC] PHP Fatal error: Uncaught Error: Call to undefined function wp_kses() in /var/www/html/wp-includes/functions.php:6019
    Stack trace: 0 /var/www/html/wp-includes/functions.php(5500): wp_trigger_error(”, ‘Function wpdb::…’, 16384) 1 /var/www/html/wp-includes/class-wpdb.php(1338): _deprecated_function(‘wpdb::escape’, ‘3.6.0’, ‘wpdb::prepare()…’) 2 /var/www/html/wp-content/sunrise.php(11): wpdb->escape(‘somewebsite.com’) 3 /var/www/html/wp-includes/ms-settings.php(47): include_once(‘/var/www/html/w…’) 4 /var/www/html/wp-settings.php(141): require(‘/var/www/html/w…’) 5 /var/www/html/wp-config.php(113): require_once(‘/var/www/html/w…’) 6 /var/www/html/wp-load.php(50): require_once(‘/var/www/html/w…’) 7 /var/www/html/wp-admin/admin.php(34): require_once(‘/var/www/html/w…’) 8 /var/www/html/wp-admin/index.php(10): require_once(‘/var/www/html/w…’) 9 {main}

    thrown in /var/www/html/wp-includes/functions.php on line 6019

    Any help or suggestions to try and fix this would be apreciated.

    Thanks

    • This topic was modified 1 week, 5 days ago by James Huff. Reason: moved to Networking WordPress since this is a multisite issue
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter londonnet

    (@londonnet)

    OK so I found on another post that the sunrise.php file and the fact I’m running multisite and domain redirect is playing a part in this. I have updated the sunrise.php with the below and this has at least allowed me to get into the main site and the admin screen.

    Old one (line 10 or 11):

    $dm_domain = $wpdb->escape( $_SERVER[ 'HTTP_HOST' ] );

    New one:

    $dm_domain = $_SERVER[ 'HTTP_HOST' ];

    I’ve been able to update the plugins used and the themes. 4 of the ones I’m not using are complaining of needing php 7.4. Nothing I can do about that till I rebuild the OS so I” remove those plugins for now

    However, I can not access any of the sub domains or sites and they all present the original critical error as before.

    Moderator bcworkz

    (@bcworkz)

    There are really only two reasons I know of where we’d get an undefined function wp_kses() error. Either your installation had become corrupted or something made an improper request such that WP is not properly initialized.

    When you tried manually updating, did you obtain a fresh download and used its contents to upload anew to your server? Prior to uploading, did you completely remove wp-admin and wp-includes folders, as well as all wp-* files in the installation root? If you overlooked any steps mentioned in the instructions, consider re-doing a manual “update” (to the same version).

    You said you tried deactivating all plugins. What about switching to a default Twenty* theme? Themes can also be a source of improper requests. Be aware that caching can confuse any investigation efforts. When you do not get expected results, try flushing any caches that might be active, both server side and client side.

    What does this sunrise.php file belong to? It’s not a core WP file. It could still be doing something else dodgy. Try deactivating whatever module it belongs to.

    BTW, $_SERVER[ ‘HTTP_HOST’ ] really should be sanitized prior to using it. $wpdb-> escape() used to be one way of doing it. Other methods exist, but which one depends on the intended use of the data. You’re most likely OK not sanitizing it, but failing to do so does create a security vulnerability. It’s OK as a temporary patch, but don’t leave it like that long term.

    Thread Starter londonnet

    (@londonnet)

    I read how wordpress multi site is installed these days and it looks like sunrise.php which appears to be responsible for the domain mapping part of multisite is no longer needed

    I removed /*define( ‘SUNRISE’, ‘on’ );

    and added define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’] );

    to wp-config.php and now all appears to be running well other than I need to update my host so it has later versions of PHP so I can update my plugins

    Thanks for the help

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.