The Spoofchecker class
Introduction
(PHP 5 >= 5.4.0, PHP 7, PECL intl >= 2.0.0)
This class is provided because Unicode contains large number of characters and incorporates the varied writing systems of the world and their incorrect usage can expose programs or systems to possible security attacks using characters similarity.
Provided methods allow to check whether an individual string is likely an attempt at confusing the reader (spoof detection
), such as "pаypаl" spelled with Cyrillic 'а' characters.
Class synopsis
Spoofchecker {
/* Constants */
/* Methods */
public areConfusable ( string $str1 , string $str2 [, string &$error ] ) : bool
public __construct ( )
public isSuspicious ( string $text [, string &$error ] ) : bool
public setAllowedLocales ( string $locale_list ) : void
public setChecks ( int $checks ) : void}
Predefined Constants
Spoofchecker::ASCII
Spoofchecker::HIGHLY_RESTRICTIVE
Spoofchecker::MODERATELY_RESTRICTIVE
Spoofchecker::MINIMALLY_RESTRICTIVE
Spoofchecker::UNRESTRICTIVE
Spoofchecker::SINGLE_SCRIPT_RESTRICTIVE
Spoofchecker::SINGLE_SCRIPT_CONFUSABLE
Spoofchecker::MIXED_SCRIPT_CONFUSABLE
Spoofchecker::WHOLE_SCRIPT_CONFUSABLE
Spoofchecker::ANY_CASE
Spoofchecker::SINGLE_SCRIPT
Spoofchecker::INVISIBLE
Spoofchecker::CHAR_LIMIT
Changelog
Version | Description |
---|---|
7.3.0 | Class constants used by Spoofchecker::setRestrictionLevel() such as Spoofchecker::ASCII , Spoofchecker::HIGHLY_RESTRICTIVE , Spoofchecker::MODERATELY_RESTRICTIVE , Spoofchecker::MINIMALLY_RESTRICTIVE , Spoofchecker::UNRESTRICTIVE , Spoofchecker::SINGLE_SCRIPT_RESTRICTIVE has been added. |
Table of Contents
- Spoofchecker::areConfusable — Checks if given strings can be confused
- Spoofchecker::__construct — Constructor
- Spoofchecker::isSuspicious — Checks if a given text contains any suspicious characters
- Spoofchecker::setAllowedLocales — Locales to use when running checks
- Spoofchecker::setChecks — Set the checks to run
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.spoofchecker.php