Hi everybody,
I'm working my way through the update-process and have arrived at the moment where I'm looking at my own wiki-pages again. <Hurray!!!>
Now I'm trying to eliminate the error-messages mediawiki is throwing at me one by one, but this one has me baffled:
PHP Warning: preg_replace_callback(): Requires argument 2, 'Sanitizer::cleanUrlCallback', to be a valid callback in /opt/lampp/htdocs/_fhbwiki/includes/Sanitizer.php on line 1477
This has me baffled because I just cleaned up the cleanUrl-function in order to clear this error-message:
PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /opt/lampp/htdocs/_fhbwiki/includes/Sanitizer.php on line 1477
and in order to do that I replaced this line of code:
$url = preg_replace( '/[][<>"\x00-\x20\x7F]/e', "urlencode('\0')", $url );
with this line from the master-source-code:
$url = preg_replace_callback( '/[][<>"\x00-\x20\x7F|]/',array( __CLASS__, 'cleanUrlCallback' ), $url );
I'm no PHP-programmer but I thought that the master-source-code would be proof-read at least and not bringing new error-messages with it... :-( Now I don't know what to do. Google isn't really helpful either.
Can anybody here point me in the right direction?
Kate
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
Hi again,
now it works. Thanks for pointing me to the correct page for getting all the source-code. Not being a programmer when I went to the normal source-code I didn't have the right understanding to see that I needed the additional function as well. ;-)
Kate
Am 21.10.2014 um 18:06 schrieb Bartosz Dziewoński:
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
mediawiki-l@lists.wikimedia.org