I don't entirely understand your problem.
On master, this part of code reads:
$url = preg_replace_callback( '/[][<>"\x00-\x20\x7F|]/', array( __CLASS__, 'cleanUrlCallback' ), $url );
And Sanitizer::cleanUrlCallback most definitely is a valid function, defined a few lines below:
static function cleanUrlCallback( $matches ) { return urlencode( $matches[0] ); }
If you patches that part of code in older MediaWiki with the version from master, you must also copy the function for it to have a chance of working. This code was last touched in 2011: http://mediawiki.org/wiki/Special:Code/MediaWiki/85421