Fix ccnorm() function -- strtr fails on empty key

ReplacementArray->replace() calls strtr() which fails if an empty key is provided.

Change-Id: I635f057dab53edcfe1736f74829b6dbe1e7739d3
This commit is contained in:
Andrew Garrett 2014-05-30 15:47:23 +10:00 committed by S Page
parent dce990fda2
commit 3b7cae1965

View file

@ -1942,12 +1942,18 @@ class AbuseFilterParser {
$equivset = null;
// Contains a map of characters in $equivset.
require "$IP/extensions/AntiSpoof/equivset.php";
// strtr in ReplacementArray->replace() doesn't like this.
if ( isset( $equivset[''] ) ) {
unset( $equivset[''] );
}
$replacementArray = new ReplacementArray( $equivset );
} else {
// AntiSpoof isn't available, so just create a dummy
wfDebugLog(
'AbuseFilter',
"Can't compute normalized string (ccnorm) as the AntiSpoof Extension isn't isntalled."
"Can't compute normalized string (ccnorm) as the AntiSpoof Extension isn't installed."
);
$replacementArray = new ReplacementArray( array() );
}