WordPress.org

Ready to get started?Download WordPress

Forums

Wrong datatype for second argument in kses (3 posts)

  1. polkadotcreations
    Member
    Posted 3 years ago #

    I just upgraded from 3.0 to 3.0.1 and am getting this error:
    Wrong datatype for second argument in kses.php

    I believe the same thing happened to me when I upgraded to 3.0, but I can't for the life of me remember how I fixed it.

    The problem appears to be with wp_kses_named_entities() on the line that calls in_array().

    Any insight?

  2. polkadotcreations
    Member
    Posted 3 years ago #

    I just noticed it only seems to be happening when I view a single post. The site index, and pages are not giving me any grief.

  3. polkadotcreations
    Member
    Posted 3 years ago #

    I figured out how I worked around it last time - here it is, in case anyone else has the same problem:

    Replace

    function wp_kses_named_entities($matches) {
    	global $allowedentitynames;
    
    	if ( empty($matches[1]) )
    		return '';
    
    	$i = $matches[1];
    	return ( ( ! in_array($i, $allowedentitynames) ) ? "&$i;" : "&$i;" );
    }

    with

    function my_in_array( $needle, $haystack ){
          if (sizeof($haystack) > 0){return in_array($needle, $haystack);}
          return false;
    }
    
    function wp_kses_named_entities($matches) {
    	global $allowedentitynames;
    
    	if ( empty($matches[1]) )
    		return '';
    
    	$i = $matches[1];
    	return ( ( ! my_in_array($i, $allowedentitynames) ) ? "&$i;" : "&$i;" );
    }

    I doubt this fixes the underlying problem, but it gets the error message off of my screen, and I haven't noticed any ill-effects.

Topic Closed

This topic has been closed to new replies.

About this Topic