2.5 not upgrading - "Fatal error"

I tried to upgrade from 1.7.3 to 2.5 by the manual method. When everything was copied over, I got this when I tried to access:

Fatal error: Cannot redeclare sanitize_url() (previously declared in /home/public/wp-includes/formatting.php:4559) in /home/public/wp-includes/deprecated.php on line 2010

I checked line 2010 and this is what was there:

function sanitize_url( $url, $protocols = null ) {
_deprecated_function( FUNCTION, ‘WP-2.8.0’, ‘esc_url_raw()’ );
return esc_url_raw( $url, $protocols );
}

Reverting manually back to 1.7.3 fixed it. Any ideas? (I have no idea what any of the above means)

Thanks in advance!

It was a deprecated function, but WP/CP un-deprecated it again, see changelog here:

Looks like CP forgot re-adding it (properly) in CP 2.

@MoJones You say you upgraded by the “manual method”. Are you sure you uploaded the correct wp-includes folder for version 2.5? Because that function does not exist in deprecated.php in version 2.5.

@Guido07111975 is correct that function was deprecated by WP and then undeprecated. My guess is that you didn’t update the file. Guido is wrong about CP forgetting to undeprecate it. We did undeprecate it!

1 Like

I think I just deleted the wp-content and wp-config folders from the 2.5 download, then copied all the remaining ones over in one go. However, it is quite possible that I managed somehow to mess things up. I’ll try again next week and let you know how it goes.

1 Like

OK, I tried again with a fresh dowload of 2.5 and EXACTLY the same thing happened. But I did mess up, perhaps because I pasted from the wrong file in my original post (formatting.php)? Sorry! This is relevant section from functions.php, lines 2007 to 2024:

/**

  • Retrieves bookmark data based on ID.
  • @since 2.0.0
  • @deprecated 2.1.0 Use get_bookmark()
  • @see get_bookmark()
  • @param int $bookmark_id ID of link
  • @param string $output Optional. Type of output. Accepts OBJECT, ARRAY_N, or ARRAY_A.
  •                        Default OBJECT.
    
  • @param string $filter Optional. How to filter the link for output. Accepts ‘raw’, ‘edit’,
  •                        'attribute', 'js', 'db', or 'display'. Default 'raw'.
    
  • @return object|array Bookmark object or array, depending on the type specified by $output.
    */
    function get_link( $bookmark_id, $output = OBJECT, $filter = ‘raw’ ) {
    _deprecated_function( FUNCTION, ‘2.1.0’, ‘get_bookmark()’ );
    return get_bookmark($bookmark_id, $output, $filter);
    }

Maybe I’m just interpreting the error message incorrectly? This stuff is way above my head.

So what is the error message now?

And is there any reason why you don’t just use the Switch to ClassicPress plugin to do the upgrade for you?

The error message is exactly the same:

Fatal error: Cannot redeclare sanitize_url() (previously declared in /home/public/wp-includes/formatting.php:4559) in /home/public/wp-includes/deprecated.php on line 2010

I can’t upgrade with a plugin because my webhost (nearlyfreespeech.net) won’t allow it. I can’t upgrade plugins via the WP backend for the same reason - I have to use CLI. It’s very security conscious.

On second thoughts, the plugin might work. I’ll give it a try.

EDITED TO ADD: No, it didn’t work. Simply refused to connect to github when I tried to run the update.

Would the command wp core update work?

I think that you could also try asking your hosting provider to do the migration for you. it just consists of taking wp-includes and wp-admin folders from CP, deleting the WP ones and replacing them with the CP ones. you trying to do that on your own on a host that blocks the migration for safety reasons and not being able to upload files properly probably is the issue here if I have understood what you tried to do.

I am convinced they would not deny the support in migrating and being basically the ones having complete access it might be easier for them to do so.

2 Likes

I agree that’s a good idea. Or else use SFTP to delete and re-upload those folders. The problem here is definitely not with CP but with the update process.

Thanks Elisabetta. I hadn’t thought of that. You’re probably right, they will help me if I ask.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.