mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Strict type comparison
Bug: T248806 Change-Id: I039ab7f103bb37052987b815412b71f70643a6d2
This commit is contained in:
parent
6274a6b657
commit
a31f4e46af
|
@ -1529,12 +1529,8 @@ class AbuseFilterParser extends AFPTransitionBase {
|
|||
* @return bool
|
||||
*/
|
||||
protected static function equalsToAny( $string, $values ) {
|
||||
$string = $string->toString();
|
||||
|
||||
foreach ( $values as $needle ) {
|
||||
$needle = $needle->toString();
|
||||
|
||||
if ( $string === $needle ) {
|
||||
if ( $string->equals( $needle, true ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
equals_to_any( "foo", "bar", "foo", "pizza" ) &
|
||||
equals_to_any( 15, 3, 77, 18, 15 ) &
|
||||
equals_to_any( "", 3, 77, 18, 15, "duh" ) === false &
|
||||
equals_to_any( "", 3, 77, 18, 15, "duh", "" )
|
||||
equals_to_any( "", 3, 77, 18, 15, "duh", "" ) &
|
||||
equals_to_any( true, 1, "true" ) === false &
|
||||
equals_to_any( "1", 1, [ 1 ], true ) === false &
|
||||
equals_to_any( [ 1, "1" ], 1, "1" ) === false &
|
||||
equals_to_any( [ 1, 2, 3 ], [ 1, 2, 3 ] ) &
|
||||
equals_to_any( [ 1, 2, 3 ], [ 3, 2, 1 ] ) === false &
|
||||
equals_to_any( [ "foo", "bar" ], [ ] ) === false &
|
||||
equals_to_any( [ "foo", "bar" ], [ "foo", "bar" ] ) &
|
||||
equals_to_any( [], [] ) &
|
||||
equals_to_any( [ 0 ], [] ) === false
|
||||
|
|
Loading…
Reference in a new issue