Subs-Compat.php
This file provides compatibility functions and code for older versions of SMF and PHP, such as missing extensions or 64-bit vs 32-bit systems.
Simple Machines Forum (SMF)
Tags
Table of Contents
Functions
- smf_crc32() : string
- Compatibility function.
- idn_to_ascii() : string|bool
- Compatibility function.
- idn_to_utf8() : string|bool
- Compatibility function.
Functions
smf_crc32()
Compatibility function.
smf_crc32(string $number) : string
crc32 doesn't work as expected on 64-bit functions - make our own. https://php.net/crc32#79567
Parameters
- $number : string
Return values
string —The crc32 polynomial of $number
idn_to_ascii()
Compatibility function.
idn_to_ascii(string $domain[, int $flags = 0 ][, int $variant = 1 ][, array<string|int, mixed>|null &$idna_info = null ]) : string|bool
This is not a complete polyfill:
- $flags only supports IDNA_DEFAULT, IDNA_NONTRANSITIONAL_TO_ASCII, and IDNA_USE_STD3_RULES.
- $variant is ignored, because INTL_IDNA_VARIANT_UTS46 is always used.
- $idna_info is ignored.
Parameters
- $domain : string
-
The domain to convert, which must be UTF-8 encoded.
- $flags : int = 0
-
A subset of possible IDNA_* flags.
- $variant : int = 1
-
Ignored in this compatibility function.
- $idna_info : array<string|int, mixed>|null = null
-
Ignored in this compatibility function.
Return values
string|bool —The domain name encoded in ASCII-compatible form, or false on failure.
idn_to_utf8()
Compatibility function.
idn_to_utf8(string $domain[, int $flags = 0 ][, int $variant = 1 ][, array<string|int, mixed>|null &$idna_info = null ]) : string|bool
This is not a complete polyfill:
- $flags only supports IDNA_DEFAULT, IDNA_NONTRANSITIONAL_TO_UNICODE, and IDNA_USE_STD3_RULES.
- $variant is ignored, because INTL_IDNA_VARIANT_UTS46 is always used.
- $idna_info is ignored.
Parameters
- $domain : string
-
Domain to convert, in an IDNA ASCII-compatible format.
- $flags : int = 0
-
Ignored in this compatibility function.
- $variant : int = 1
-
Ignored in this compatibility function.
- $idna_info : array<string|int, mixed>|null = null
-
Ignored in this compatibility function.
Return values
string|bool —The domain name in Unicode, encoded in UTF-8, or false on failure.