首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Spoofchecker (class)

Introduction

(PHP >= 5.4.0, 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 alllow 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 */

const integer SINGLE_SCRIPT_CONFUSABLE = 1 ;

const integer MIXED_SCRIPT_CONFUSABLE = 2 ;

const integer WHOLE_SCRIPT_CONFUSABLE = 4 ;

const integer ANY_CASE = 8 ;

const integer SINGLE_SCRIPT = 16 ;

const integer INVISIBLE = 32 ;

const integer CHAR_LIMIT = 64 ;

/* Methods */

代码语言:javascript
复制
public bool areConfusable ( string $str1 , string $str2 [, string &$error ] )
代码语言:javascript
复制
public __construct ( void )
代码语言:javascript
复制
public bool isSuspicious ( string $text [, string &$error ] )
代码语言:javascript
复制
public void setAllowedLocales ( string $locale_list )
代码语言:javascript
复制
public void setChecks ( long $checks )

}

Predefined Constants

Spoofchecker::SINGLE_SCRIPT_CONFUSABLESpoofchecker::MIXED_SCRIPT_CONFUSABLESpoofchecker::WHOLE_SCRIPT_CONFUSABLESpoofchecker::ANY_CASESpoofchecker::SINGLE_SCRIPTSpoofchecker::INVISIBLESpoofchecker::CHAR_LIMIT

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

← ResourceBundle::getLocales

Spoofchecker::areConfusable →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com