WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Apply patch for bug (9640.patch) or wait for new stable release? (6 posts)

  1. BestofNJ.com
    Member
    Posted 5 years ago #

    I seem to have found a bug in my installation and there is a patch for it. See:

    http://core.trac.wordpress.org/ticket/9638
    http://core.trac.wordpress.org/ticket/9640

    Can anyone tell me how to apply a patch? I am not comfortable writing or changing code. I have not found any help files on applying patches.

    Should I just wait for the next stable release?

    When is the next release scheduled?

    Will it resolve this problem?

    John

  2. Mark / t31os
    Moderator
    Posted 5 years ago #

    This would mean editting a core WP file.

    wp-includes/functions.php

    http://core.trac.wordpress.org/attachment/ticket/9640/9640.patch

    Red coloured lines indicate the existing code.
    Green lines indicate the new code (to go in place of).

    Line numbers are to the left so it's hard to go wrong.

    Find the RED parts in the file, overwrite those with the GREEN parts, using the line numbers as a reference.

  3. BestofNJ.com
    Member
    Posted 5 years ago #

    T,

    Thanks for the help. Their numbers do not match mine. Is that a different version they are using? and can I apply to this to a live site?

    I did find the right lines, but I just want to be sure that this is OK before I do it.

    John

  4. Mark / t31os
    Moderator
    Posted 5 years ago #

    Yes you're right the lines for said code are.

    Lines: 1246 - 1257

    This area.

    function add_magic_quotes( $array ) {
    	global $wpdb;
    
    	foreach ( (array) $array as $k => $v ) {
    		if ( is_array( $v ) ) {
    			$array[$k] = add_magic_quotes( $v );
    		} else {
    			$array[$k] = $wpdb->escape( $v );
    		}
    	}
    	return $array;
    }

    Update that with..

    function add_magic_quotes( $array ) {
    	global $wpdb;
    
    	if ( is_array($array) ) {
    		foreach ( $array as $k => $v ) {
    			$array[$k] = add_magic_quotes( $v );
    		}
     	} elseif ( is_string($array) ) {
     		$array = $wpdb->escape( $array );
     	}
    	return $array;
    }

    I think that's right....

    Backup first if in doubt...

  5. BestofNJ.com
    Member
    Posted 5 years ago #

    T,

    I finally had the guts to slog through and it did solve the problem. I can now change information on my profile and work with other user accounts. Now I have to figure out what is causing me to get question marks in my post editor box in every place where I have two spaces!

    I am very grateful for the help and for your patience with me!

    John

  6. Treebeard
    Member
    Posted 4 years ago #

    I just had a client contact me today with this issue, they are using 2.8.5 but I'm updating this to 2.8.6 in a moment. If this is an old bug, why is he seeing this now? I don't feel comfortable updating the .php file because my line numbers are not even remotely close to what I see shown above.

    Any idea why this would show up now with an upgrade?

    ** UPDATE **

    I did upgrade to 2.8.6 and still had the issue, but found the text to be changed and the patch worked great.
    Thank you so much for posting that!

Topic Closed

This topic has been closed to new replies.

About this Topic