\

Classes

OpenSSLAsymmetricKey A key, holding PEM text rather than a native handle.
OpenSSLCertificate A certificate, holding its PEM text.
PhpWasmSyncFiber
SodiumException
XMLWriter Enough of libxml's writer to generate a sitemap, and no more.

Constants

BROTLI_COMPRESS_LEVEL_DEFAULT

BROTLI_COMPRESS_LEVEL_DEFAULT = 11

BROTLI_COMPRESS_LEVEL_MAX

BROTLI_COMPRESS_LEVEL_MAX = 11

BROTLI_COMPRESS_LEVEL_MIN

BROTLI_COMPRESS_LEVEL_MIN = 0

BROTLI_FONT

BROTLI_FONT = 2

BROTLI_GENERIC

BROTLI_GENERIC = 0

BROTLI_TEXT

BROTLI_TEXT = 1

FILEINFO_EXTENSION

FILEINFO_EXTENSION = 16777216

FILEINFO_MIME

FILEINFO_MIME = 1040

FILEINFO_MIME_ENCODING

FILEINFO_MIME_ENCODING = 1024

FILEINFO_MIME_TYPE

FILEINFO_MIME_TYPE = 16

FILEINFO_NONE

FILEINFO_NONE = 0

FORCE_DEFLATE

FORCE_DEFLATE = 15

FORCE_GZIP

FORCE_GZIP = 31

OPENSSL_VERSION_TEXT

OPENSSL_VERSION_TEXT = 'BoringSSL (node:crypto)'

ZLIB_ENCODING_DEFLATE

ZLIB_ENCODING_DEFLATE = 15

ZLIB_ENCODING_GZIP

ZLIB_ENCODING_GZIP = 31

ZLIB_ENCODING_RAW

ZLIB_ENCODING_RAW = -15

ZSTD_COMPRESS_LEVEL_DEFAULT

ZSTD_COMPRESS_LEVEL_DEFAULT = 3

ZSTD_COMPRESS_LEVEL_MAX

ZSTD_COMPRESS_LEVEL_MAX = 22

ZSTD_COMPRESS_LEVEL_MIN

ZSTD_COMPRESS_LEVEL_MIN = 1

Functions

brotli_compress()

brotli_compress(string  $data, int  $level = 11, int  $mode = 0, string|null  $dict = null) : string|false

Compresses a string with brotli.

Parameters

string $data

The bytes to compress.

int $level

A brotli quality, 0 to 11.

int $mode

BROTLI_GENERIC, BROTLI_TEXT or BROTLI_FONT.

string|null $dict

Not supported on this host; a non-empty value is refused.

Returns

string|false —

The compressed bytes, or FALSE on failure.

brotli_uncompress()

brotli_uncompress(string  $data, string|null  $dict = null) : string|false

Decompresses a brotli stream.

Parameters

string $data

The brotli stream.

string|null $dict

Not supported on this host; a non-empty value is refused.

Returns

string|false —

The decompressed bytes, or FALSE on failure.

cfw_argon2_available()

cfw_argon2_available() : bool

Returns

bool —

cfw_argon2_b64()

cfw_argon2_b64(string  $raw) : string

unpadded base64, which is what PHP's own argon2 encoding uses

Parameters

string $raw

The bytes to encode.

Returns

string —

cfw_argon2_hash()

cfw_argon2_hash(string  $password, int  $m = 19456, int  $t = 2, int  $p = 1) : string|null

Hashes into PHP's own encoded form.

Parameters

string $password

The password to hash.

int $m

Memory cost in KiB.

int $t

Time cost.

int $p

Lanes.

Returns

string|null —

The encoded hash, or NULL when the host refused.

cfw_argon2_needs_rehash()

cfw_argon2_needs_rehash(string  $encoded, int  $m = 19456, int  $t = 2, int  $p = 1) : bool

whether an existing encoded hash was written with weaker parameters than today's

Parameters

string $encoded

The stored hash.

int $m

Memory cost in KiB.

int $t

Time cost.

int $p

Lanes.

Returns

bool —

cfw_argon2_raw()

cfw_argon2_raw(string  $password, string  $salt, int  $m, int  $t, int  $p, int  $tagLen = 32) : string|false|null

Parameters

string $password

The password bytes.

string $salt

The salt bytes.

int $m

Memory cost in KiB.

int $t

Time cost.

int $p

Lanes.

int $tagLen

Output length in bytes.

Returns

string|false|null —

The raw tag, FALSE when the reply was not base64, or NULL when the host refused.

cfw_argon2_verify()

cfw_argon2_verify(string  $password, string  $encoded) : bool

Verifies against an encoded hash, in constant time.

hash_equals() rather than ===, because a byte-at-a-time comparison of a password digest is a timing oracle even when the digest itself is memory-hard.

Parameters

string $password

The password to check.

string $encoded

A hash cfw_argon2_hash() or PHP's own password_hash() wrote.

Returns

bool —

cfw_batch_yield()

cfw_batch_yield(int  $ops) : bool

Whether _batch_process() should end this request, read after every operation.

Yields on the operation count or when the host reports the isolate near its ceiling, whichever comes first; memory_get_usage() reads 0 in this build, so the host is asked.

Parameters

int $ops

Operations run so far in this request.

Returns

bool —

cfw_brotli()

cfw_brotli(string  $op, string  $data, int  $level = 11, int  $mode = 0, string  $dict = '') : array{ok: bool, data?: string, error?: string}

Runs one op over the bridge.

Parameters

string $op

The operation, compress or uncompress.

string $data

The bytes to transform.

int $level

A brotli quality, 0 to 11.

int $mode

BROTLI_GENERIC, BROTLI_TEXT or BROTLI_FONT.

string $dict

A preset dictionary, or an empty string for none. The host refuses one.

Returns

array{ok: bool, data?: string, error?: string} —

The decoded reply, or the reason it failed.

cfw_brotli_fail()

cfw_brotli_fail(string  $name, string  $reason) : false

Raises the diagnostic ext-brotli raises, then answers FALSE like it does.

Parameters

string $name

The PHP function that failed.

string $reason

What ext-brotli would have said.

Returns

false —

cfw_call()

cfw_call(callable  $fn, array  $payload) : array<string,mixed>

Sends one request across the bridge and decodes the reply.

Parameters

callable $fn

The host function from cfw_host().

array $payload

The request, run through the pw codec.

Returns

array —

The decoded reply, or an ok => false refusal naming what went wrong.

cfw_close_session()

cfw_close_session() : string

Closes the session an earlier render left open.

Returns

string —

What was done, for the probe that reports it.

cfw_curl_absent()

cfw_curl_absent() : false

Declares the gap once, then answers the way curl answers a connection it cannot make.

Never silently absent. Without the module there is no queue to defer into, so the honest answer is the same FALSE a caller already handles -- but an operator gets a status-report row saying why instead of an unexplained failure.

Returns

false —

cfw_curl_installed()

cfw_curl_installed() : bool

Returns

bool —

cfw_curl_shim()

cfw_curl_shim() : \Drupal\drupflare\Shim\CurlShim|null

The one shim instance, resolved on FIRST USE rather than at declaration time.

This fragment runs from ensurePhp(), which is before Drupal's autoloader exists, so a class_exists() guard around the declarations would never pass and the functions would never be declared at all. Resolving here instead means the class is looked up when a caller actually makes a request, by which time the module is loaded.

Returns

\Drupal\drupflare\Shim\CurlShim|null —

NULL when the module is not loaded, which every caller below treats as a refusal.

cfw_degraded()

cfw_degraded(string  $capability, string  $why, string  $state = 'blocked') : void

Parameters

string $capability

The capability that degraded.

string $why

Why it did.

string $state

The module table's word for it: verified, untested or blocked.

Returns

void —

cfw_extensions_installed()

cfw_extensions_installed() : bool

Marks that the extension functions below are in place.

Returns

bool —

Always TRUE.

cfw_guzzle_handler()

cfw_guzzle_handler() : object|null

The transport a Guzzle client built with no handler gets, read by the pack's chooseHandler().

Returns

object|null —

A handler, or NULL when the drupflare module is not loaded.

cfw_host()

cfw_host(string  $name) : mixed

Reads a capability the host installed on the Module.

Parameters

string $name

The capability the host installed on the Module.

Returns

mixed —

The host function, or NULL when there is no bridge.

cfw_iconv_strrpos()

cfw_iconv_strrpos(string  $haystack, string  $needle, string|null  $encoding = null) : int|false

Parameters

string $haystack

The text to search.

string $needle

What to look for.

string|null $encoding

The charset of both, or NULL for the polyfill's internal one.

Returns

int|false —

The character offset of the last match.

cfw_listener_shape()

cfw_listener_shape(callable|array|object|string  $c) : string

Describes a collected listener without calling it.

Parameters

callable|array|object|string $c

A collected listener.

Returns

string —

cfw_mb_ascii()

cfw_mb_ascii(mixed  $s) : bool

True when no byte is >= 0x80, so the single-byte string functions are exact.

Parameters

mixed $s

The value to test.

Returns

bool —

cfw_mb_decode_subst()

cfw_mb_decode_subst(string  $s, string  $from) : ?string

The same substitution in the DECODE direction: a source byte the charmap does not know becomes "?" instead of vanishing.

Walks the source the way the polyfill's own mapToUtf8 does -- a two-byte key first, then a one-byte key -- so it is right for SJIS and Big5 as well as for the single-byte charsets. The pair was used exactly when its answer is not the two singles concatenated; where those agree, either choice produces the same bytes.

Returns null when it does not apply, which leaves the polyfill's answer alone: an unknown charset (no charmap ships for EUC-JP) and a source with nothing unmappable both take that path, and the second is the common one.

Parameters

string $s

Source bytes in the named charset.

string $from

The charset the bytes are in.

Returns

?string —

cfw_mb_encode_subst()

cfw_mb_encode_subst(string  $s, string  $to) : string

Replaces every character the TARGET encoding cannot represent with "?", which is what native mb_convert_encoding does and what the polyfill does not.

The polyfill converts with //IGNORE, so an unmappable character is DROPPED: a Cyrillic sentence converted to ISO-8859-1 comes back as its spaces. One whole-string probe decides -- iconv without //IGNORE answers false only when something is unmappable -- so the per-character loop is paid by the strings that actually need it.

Parameters

string $s

Well-formed UTF-8.

string $to

The target charset.

Returns

string —

cfw_mb_final_sigma()

cfw_mb_final_sigma(string  $lo) : string|null

Applies Unicode SpecialCasing final-sigma to an ALREADY-lowercased string.

Not applied to mb_strtoupper: there is no uppercase counterpart and running it there would corrupt correct output. The strpos() guard is the common case -- a string with no sigma in it cannot need this.

Parameters

string $lo

The lowercased text.

Returns

string|null —

The text with final sigmas applied, or NULL when the pattern failed.

cfw_mb_fold_safe()

cfw_mb_fold_safe(string  $s) : string

A length-PRESERVING fold, which is what the case-insensitive searches need.

The polyfill lowercases first, and one codepoint lowercases to two (U+0130 gives i plus a combining dot), so every index past it shifts and mb_stripos answers an offset into a string the caller never passed.

Parameters

string $s

Well-formed UTF-8.

Returns

string —

cfw_mb_iconv_label()

cfw_mb_iconv_label(mixed  $enc) : mixed

Spells a charset the way symfony/polyfill-iconv's alias table spells it.

THE CHARMAPS ARE PRESENT AND THE NAMES ARE NOT. Measured against the polyfill rather than against the real extension: SJIS, GBK, BIG5 and EUC-KR are all REFUSED outright, while Shift_JIS, CP936, CP950 and CP949 decode -- out of the same 55 from.*.php files. So the gap that looked like missing capability is six alias entries.

CP950 and CP949 are SUPERSETS of Big5 and EUC-KR, so those two decode every assigned byte correctly and additionally decode bytes the narrower charset leaves unassigned, where mbstring substitutes. That is a real difference and it is why they are named here rather than presented as exact. EUC-JP and ISO-2022-JP ship no charmap at all and stay refused.

Parameters

mixed $enc

The charset the caller named.

Returns

mixed —

The polyfill's spelling, or the input when it is not a string or needs no alias.

cfw_mb_installed()

cfw_mb_installed() : bool

Returns

bool —

cfw_mb_isubpart()

cfw_mb_isubpart(string  $haystack, int|false  $pos, bool  $before, string|null  $encoding) : string|false

Case-insensitive search on the ORIGINAL haystack.

The polyfill returns a slice of its own lowercased copy, so a haystack containing a character that lowercases to two comes back with different bytes than went in.

Parameters

string $haystack

The original text.

int|false $pos

Where the needle was found, or FALSE.

bool $before

Return the part before the match rather than from it.

string|null $encoding

The encoding the caller named.

Returns

string|false —

cfw_mb_patch()

cfw_mb_patch(string  $s, string  $which) : string

Pre-maps the codepoints the polyfill would answer wrongly, so its own pass then sees a character it already agrees with.

Pre and not post: the polyfill's wrong answer is ambiguous -- three characters share one stale uppercase -- so a table keyed on its OUTPUT cannot recover the input it came from. strpbrk first, because a string carrying none of the keys' lead bytes cannot need the strtr.

Parameters

string $s

Well-formed UTF-8.

string $which

lower or upper.

Returns

string —

cfw_mb_sanitize()

cfw_mb_sanitize(mixed  $s, string  $sub = '?') : mixed

Replaces every ill-formed UTF-8 sequence with "?".

Matches native mbstring byte for byte, and the rule is NOT one "?" per bad byte -- that was measured, not assumed. Native emits ONE "?" per maximal valid PREFIX it consumed, then resumes at the byte that broke the sequence:

$sub exists for one caller: mb_convert_case TITLE, which needs the substituted run to be a case-IGNORABLE character rather than "?" while the word boundaries are found.

"abc\xe4\xbddef" -> abc?def one "?", two bytes consumed "abc\xe4\xbd" -> abc? same at end of string "abc\xed\xa0\x80def" -> abc???def ED is a valid lead but A0 is out of its range, so ED alone is one "?" and A0 and 80 are then lone continuations "abc\xc0\xafdef" -> abc??def C0 is never a valid lead "abc\xf5\x80\x80\x80def" -> abc????def

A first version advanced one byte at a time on failure and got the truncated cases wrong (abc?? for abc?). The oracle is native mb_substr(); the gate test pins every case above against it.

Parameters

mixed $s

The string to clean; anything else is returned as it came.

string $sub

What replaces each ill-formed run.

Returns

mixed —

The cleaned string, or the input when it was not a string.

cfw_mb_title_char()

cfw_mb_title_char(string  $ch) : ?string

The titlecase of a word-initial character, or null where the polyfill is already right.

Parameters

string $ch

One character.

Returns

?string —

cfw_mb_title_extra()

cfw_mb_title_extra() : string

The class body spliced into the word pattern, empty when the pack is absent.

Returns

string —

cfw_mb_title_regexp()

cfw_mb_title_regexp() : string|null

The word-boundary pattern for titlecasing, built from the polyfill's Case_Ignorable data.

The 6,201-byte character class is READ from the package rather than copied, so upstream keeps owning the Unicode half; the two-line grammar around it is replaced, because upstream's lookbehind-then-two-letter-groups is wrong in both directions. It blocks a match on the letter after an ignorable and then RE-ENTERS on the letter after that, so "abc<SHY>def" comes out "Abc<SHY>dEf" where mbstring gives "Abc<SHY>def". Consuming ignorables in the word TAIL fixes it: a character inside a match is never offered a second start.

null means the package moved and every caller falls back to the polyfill's own title path.

Returns

string|null —

The pattern, or NULL when the polyfill's data file is not where it was.

cfw_mb_title_word()

cfw_mb_title_word(array  $m) : string

One word: its first character titlecased, the rest lowercased.

The polyfill UPPERCASES the first character, which is a different operation for the 31 Lt digraphs and for every ligature that expands (native titlecases U+FB01 to "Fi", the polyfill uppercases it to "FI").

Parameters

array $m

The match: the whole word, its first character, and its tail.

Returns

string —

cfw_mb_unicode_data()

cfw_mb_unicode_data() : array<string,mixed>

The table, or an empty one.

An empty table is not a failure mode, it is the polyfill unchanged: every lookup misses, cfw_mb_patch returns its input and both generated patterns come back null, so a site with no driver pack answers exactly what it answered before the table existed.

Returns

array —

The case, width and lead-byte tables keyed by name.

cfw_mb_utf8()

cfw_mb_utf8(string|null  $encoding) : bool

The case tables are keyed by utf-8, so a caller naming another encoding must not reach them.

Parameters

string|null $encoding

The encoding the caller named.

Returns

bool —

cfw_mb_wide_regexp()

cfw_mb_wide_regexp() : ?string

East asian width from mbstring's table; null when the pack is absent.

Returns

?string —

cfw_mb_width()

cfw_mb_width(string  $s, string  $re) : int

Parameters

string $s

Well-formed UTF-8.

string $re

The pattern from cfw_mb_wide_regexp().

Returns

int —

cfw_openssl_cipher()

cfw_openssl_cipher(string  $cipher) : array{0: int, 1: int, 2: string}|null

Key and IV length for a supported cipher, or NULL.

Parameters

string $cipher

A cipher name.

Returns

array{0: int, 1: int, 2: string}|null —

[key bytes, iv bytes, mode].

cfw_openssl_crypt()

cfw_openssl_crypt(string  $dir, string  $data, string  $cipher_algo, string  $passphrase, int  $options, string  $iv, string|false|null  $tag, string  $aad, int  $tag_length) : array<string,mixed>|false

The shared half of encrypt and decrypt: key and IV sized the way ext-openssl sizes them.

A short key is padded with NUL and a long one truncated, silently, as ext-openssl does. A short IV is padded with a warning; a GCM IV keeps whatever length the caller gave.

Parameters

string $dir

'enc' or 'dec'.

string $data

The plaintext, or the ciphertext.

string $cipher_algo

A cipher name.

string $passphrase

The key material.

int $options

OPENSSL_RAW_DATA and OPENSSL_ZERO_PADDING flags.

string $iv

The initialisation vector.

string|false|null $tag

The GCM tag, on decrypt.

string $aad

Additional authenticated data, for GCM.

int $tag_length

The GCM tag length in bytes.

Returns

array|false —

The bridge reply, or FALSE for an unknown cipher or a malformed ciphertext.

cfw_openssl_degraded()

cfw_openssl_degraded(string  $capability, string  $why) : void

Declares a failure to the operator, the way curl-fix.ts does.

A per-call trigger_error reaches the log and never the status report, and a failed verify had neither -- so a caller misreading -1 as "forged" was invisible from outside.

Parameters

string $capability

The capability that degraded.

string $why

Why it did.

Returns

void —

cfw_openssl_installed()

cfw_openssl_installed() : bool

Returns

bool —

cfw_openssl_pem()

cfw_openssl_pem(\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string  $key, string  $want) : string

The PEM text for whatever ext-openssl would accept as a key or certificate.

Parameters

\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $key

A key object, a certificate object, a two-key array, a PEM or a file:// path.

string $want

'private' for the private half, 'public' for the public half or a certificate.

Returns

string —

cfw_serve()

cfw_serve(string  $path, bool|string  $destruct = true, string  $method = 'GET', string  $body = '', string  $contentType = '', string  $cookieHeader = '', string  $origin = '', string  $clientIp = '', string  $accept = '', array  $headers = []) : \Symfony\Component\HttpFoundation\Response

Runs one request through the booted kernel and returns the response.

Parameters

string $path

The request path, with its query string.

bool|string $destruct

True, false, or a comma-separated allowlist of service ids to destruct.

string $method

The HTTP method.

string $body

The raw request body.

string $contentType

The request content type.

string $cookieHeader

The raw Cookie header.

string $origin

A scheme://host[:port], or an empty string.

string $clientIp

The visitor's address, or an empty string.

string $accept

The raw Accept header, or an empty string.

array $headers

Every other inbound header, lowercase name to value, such as authorization.

Returns

\Symfony\Component\HttpFoundation\Response —

The kernel's response.

cfw_sign_call()

cfw_sign_call(array  $payload) : array<string,mixed>

Runs one op over the bridge.

Parameters

array $payload

The request, including its op.

Returns

array —

The decoded reply, always with an 'ok' key.

cfw_sleep_ms()

cfw_sleep_ms(float|int  $ms, string  $fn) : bool

Waits through the host, or returns at once and records how short it fell.

Parameters

float|int $ms

How long to wait, in milliseconds.

string $fn

The PHP function the caller used, for the degradation row.

Returns

bool —

Whether the whole wait happened.

cfw_sodium_arg()

cfw_sodium_arg(string  $fn, int  $at, string  $name, mixed  $v) : string

A string argument, coerced.

Parameters

string $fn

The function name.

int $at

The argument's zero-based position.

string $name

The parameter name.

mixed $v

The argument.

Returns

string —

cfw_sodium_dec()

cfw_sodium_dec(array  $v) : mixed

Reads one tagged value out of a reply.

Parameters

array $v

The tagged value.

Returns

mixed —

cfw_sodium_exchange()

cfw_sodium_exchange(string  $fn, array  $args) : array<string,mixed>

One call over the bridge.

Parameters

string $fn

The sodium function.

array $args

Its arguments, already base64 or decimal.

Returns

array —

The successful reply.

cfw_sodium_fail()

cfw_sodium_fail(string  $why) : never

Raises what ext-sodium raises.

Parameters

string $why

The message.

Throws

\SodiumException

Returns

never —

cfw_sodium_go()

cfw_sodium_go(string  $fn, array  $args) : mixed

Runs one wrapper's call: coerces each argument by its declared kind, crosses the bridge, and writes back any by-reference state.

Parameters

string $fn

The sodium function, from FUNCTION.

array $args

The wrapper's arguments, by reference where the function takes a state.

Returns

mixed —

cfw_sodium_installed()

cfw_sodium_installed() : bool

Returns

bool —

cfw_sodium_int()

cfw_sodium_int(string  $fn, int  $at, string  $name, mixed  $v) : string

An int argument as the decimal string the host reads.

Parameters

string $fn

The function name, for the message.

int $at

The argument's zero-based position.

string $name

The parameter name.

mixed $v

What the caller passed.

Returns

string —

cfw_sodium_ref()

cfw_sodium_ref(string  $fn, int  $at, string  $name, mixed  $v) : string

A by-reference state argument; anything but a string is not a state.

Parameters

string $fn

The function name, for the message.

int $at

The argument's zero-based position.

string $name

The parameter name.

mixed $v

What the caller passed.

Returns

string —

cfw_sodium_same_length()

cfw_sodium_same_length(string  $fn, string  $a, string  $b) : void

Two same-length arguments, or the refusal ext-sodium gives.

Parameters

string $fn

The function name.

string $a

The first string.

string $b

The second string.

Returns

void —

cfw_sodium_str()

cfw_sodium_str(string  $fn, int  $at, string  $name, mixed  $v) : string

A string argument as the base64 the host reads, coerced the way an internal function coerces it.

Parameters

string $fn

The function name, for the message.

int $at

The argument's zero-based position.

string $name

The parameter name.

mixed $v

What the caller passed.

Returns

string —

cfw_sodium_string_ref()

cfw_sodium_string_ref(mixed  $v) : string

The message for a by-reference argument that is not a string.

Parameters

mixed $v

The argument.

Returns

string —

cfw_sodium_variant()

cfw_sodium_variant(string  $fn, mixed  $id) : array{0: bool, 1: bool}

The base64 variant flags: padded, URL-safe.

Parameters

string $fn

The function name.

mixed $id

The caller's variant.

Returns

array{0: bool, 1: bool} —

cfw_sql()

cfw_sql(string  $sql, array  $params = []) : array<string,mixed>

Runs one SQL statement on the object's database.

Parameters

string $sql

One statement.

array $params

Positional or named bindings.

Returns

array —

The host reply: ok, and rows on a read.

cfw_standins_installed()

cfw_standins_installed() : bool

Returns

bool —

cfw_symfony_http_client()

cfw_symfony_http_client(array  $defaultOptions = []) : object|null

What a delivered symfony/http-client's HttpClient::create() answers with, once rewritten.

Parameters

array $defaultOptions

The options the caller passed to create().

Returns

object|null —

A client, or NULL when the drupflare module is not loaded.

cfw_txn()

cfw_txn(array}>  $statements, bool  $commit = true, array{sql: string, params: array}|null  $read = null) : array<string,mixed>

Runs statements in one transaction, optionally reading inside it.

Parameters

array}> $statements

The statements to run in one transaction.

bool $commit

Whether to commit rather than roll back.

array{sql: string, params: array}|null $read

A statement to run inside the transaction and report.

Returns

array —

The host reply: ok, and readResult when a read was asked for.

cfw_zlib()

cfw_zlib(string  $op, string  $data, int  $level = -1, string  $dict = '') : array{ok: bool, data?: string, error?: string}

Runs one op over the bridge.

Parameters

string $op

gzip, gunzip, zlib, unzlib, deflate or inflate.

string $data

The bytes to transform.

int $level

A zlib level, or -1 for the default.

string $dict

A preset dictionary, or an empty string for none.

Returns

array{ok: bool, data?: string, error?: string} —

['ok' => true, 'data' => string] or ['ok' => false, 'error' => string].

cfw_zlib_cap()

cfw_zlib_cap(string  $name, string  $data, int  $max_length) : string|false

Applies $max_length the way zlib does, which is NOT a truncation.

Measured: gzuncompress(gzcompress('hello world'), 5) is FALSE, not 'hello'. zlib fails the inflate when its output buffer is too small, so a cap below the payload is a data error rather than a short read. 0 means no cap.

Parameters

string $name

The PHP function being called.

string $data

The inflated bytes.

int $max_length

The cap, or 0 for none.

Returns

string|false —

The bytes, or FALSE with an E_USER_WARNING when the cap was exceeded.

cfw_zlib_dict()

cfw_zlib_dict(string  $op, string  $data, string  $dict, int  $level = -1) : string|false

Compresses or decompresses against a preset dictionary.

NOT shaped like a gz* function: PHP has never had a dictionary parameter on gzcompress(), so widening one of those signatures would make a host-only argument look like part of the language. function_exists('cfw_zlib_dict') is the feature test a caller uses.

$op is 'zlib' to compress and 'unzlib' to decompress; the output is an ordinary zlib stream with FDICT set. gzip and the raw pair are refused, because neither has anywhere to record the dictionary's checksum -- so a wrong dictionary would decode to plausible garbage instead of failing.

Parameters

string $op

zlib or unzlib.

string $data

The bytes to transform.

string $dict

The preset dictionary.

int $level

A zlib level, or -1 for the default.

Returns

string|false —

The bytes, or FALSE with an E_USER_WARNING, matching the gz* functions.

cfw_zlib_encoding()

cfw_zlib_encoding(string  $name, int  $encoding) : string

The container an encoding names.

All three encoders accept all three encodings and emit that container -- measured on 8.5.7, gzcompress(x, 9, ZLIB_ENCODING_GZIP) is byte-identical to gzencode(x, 9, FORCE_GZIP) -- so the three share one mapping.

Parameters

string $name

The PHP function being called.

int $encoding

A ZLIB_ENCODING_* value.

Returns

string —

cfw_zlib_fail()

cfw_zlib_fail(string  $name, string  $reason) : false

Raises the diagnostic ext-zlib raises, then answers FALSE like it does.

Parameters

string $name

The PHP function that failed.

string $reason

What ext-zlib would have said.

Returns

false —

cfw_zlib_installed()

cfw_zlib_installed() : bool

Returns

bool —

cfw_zlib_level()

cfw_zlib_level(string  $name, int  $level) : int

Refuses a level outside -1..9, with the ValueError ext-zlib throws.

Parameters

string $name

The PHP function being called.

int $level

The level the caller passed.

Returns

int —

The level, unchanged.

cfw_zstd()

cfw_zstd(string  $op, string  $data, int  $level = 3, string  $dict = '') : array{ok: bool, data?: string, error?: string}

Runs one op over the bridge.

Parameters

string $op

The operation, compress or uncompress.

string $data

The bytes to transform.

int $level

A zstd level, 1 to 22 (or zero and below).

string $dict

A preset dictionary, or an empty string for none.

Returns

array{ok: bool, data?: string, error?: string} —

The decoded reply, or the reason it failed.

cfw_zstd_fail()

cfw_zstd_fail(string  $name, string  $reason) : false

Raises the diagnostic ext-zstd raises, then answers FALSE like it does.

Parameters

string $name

The PHP function that failed.

string $reason

What ext-zstd would have said.

Returns

false —

curl_close()

curl_close(array|false  $handle) : mixed

Parameters

array|false $handle

The handle curl_init() returned.

Returns

mixed —

curl_errno()

curl_errno(array|false  $handle) : int

Parameters

array|false $handle

The handle curl_init() returned.

Returns

int —

curl_error()

curl_error(array|false  $handle) : string

Parameters

array|false $handle

The handle curl_init() returned.

Returns

string —

curl_exec()

curl_exec(array|false  $handle) : string|bool

Parameters

array|false $handle

The handle curl_init() returned.

Returns

string|bool —

curl_getinfo()

curl_getinfo(array|false  $handle, int|null  $key = null) : mixed

Parameters

array|false $handle

The handle curl_init() returned.

int|null $key

A CURLINFO_* constant, or NULL for every field.

Returns

mixed —

curl_init()

curl_init(string|null  $url = null) : array<string,mixed>|false

Parameters

string|null $url

The URL to request, or NULL to set it later.

Returns

array|false —

The opaque handle, or FALSE when the shim is unavailable.

curl_reset()

curl_reset(array|false  $handle) : mixed

Parameters

array|false $handle

The handle curl_init() returned.

Returns

mixed —

curl_setopt()

curl_setopt(array|false  $handle, int  $option, mixed  $value) : bool

Parameters

array|false $handle

The handle curl_init() returned.

int $option

A CURLOPT_* constant.

mixed $value

The option value.

Returns

bool —

curl_setopt_array()

curl_setopt_array(array|false  $handle, array  $options) : bool

Parameters

array|false $handle

The handle curl_init() returned.

array $options

CURLOPT_* constants mapped to their values.

Returns

bool —

curl_version()

curl_version() : array<string,mixed>

Reports a version the way ext-curl does, so a caller's feature test has something to read.

The version string names this shim rather than a curl release: a caller comparing against a real curl version must not conclude a feature is present because the number looked new enough.

Returns

array —

exec()

exec(string  $command, string[]|null  $output = null, int|null  $result_code = null) : string|false

Parameters

string $command

The command line.

string[]|null $output

Set to the output lines.

int|null $result_code

Set to the exit code.

Returns

string|false —

exif_read_data()

exif_read_data(string|resource  $file, string|null  $required_sections = null, bool  $as_arrays = false, bool  $read_thumbnail = false) : array<string,mixed>|false

Parameters

string|resource $file

A path or an open stream.

string|null $required_sections

Comma-separated sections the result must carry.

bool $as_arrays

Return sections as arrays.

bool $read_thumbnail

Also read the embedded thumbnail.

Returns

array|false —

extension_loaded()

extension_loaded(string  $extension) : bool

Tells whether an extension is loaded, counting the gated shims.

Parameters

string $extension

An extension name, in any case.

Returns

bool —

TRUE when the extension is built in or a gated shim covers its whole API.

finfo_buffer()

finfo_buffer(object  $finfo, string  $string, int  $flags = 0, resource|null  $context = null) : string|false

Parameters

object $finfo

The finfo instance.

string $string

The bytes to inspect.

int $flags

FILEINFO_* flags.

resource|null $context

Ignored.

Returns

string|false —

finfo_close()

finfo_close(object  $finfo) : bool

Parameters

object $finfo

The finfo instance.

Returns

bool —

finfo_file()

finfo_file(object  $finfo, string  $filename, int  $flags = 0, resource|null  $context = null) : string|false

Parameters

object $finfo

The finfo instance.

string $filename

A path.

int $flags

FILEINFO_* flags.

resource|null $context

Ignored.

Returns

string|false —

finfo_open()

finfo_open(int  $flags = 0, string|null  $magic_database = null) : object|false

Parameters

int $flags

FILEINFO_* flags.

string|null $magic_database

Ignored.

Returns

object|false —

finfo_set_flags()

finfo_set_flags(object  $finfo, int  $flags) : mixed

Parameters

object $finfo

The finfo instance.

int $flags

FILEINFO_* flags.

Returns

mixed —

get_extension_funcs()

get_extension_funcs(string  $extension) : array<int,string>|false

Lists the functions an extension provides, counting the gated shims.

Parameters

string $extension

An extension name, in any case.

Returns

array|false —

The function names, or FALSE when the extension is unknown or has none.

get_loaded_extensions()

get_loaded_extensions(bool  $zend_extensions = false) : array<int,string>

Answers from a catalog of extension names, because the built-in that listed them is gone.

Parameters

bool $zend_extensions

Whether to list Zend extensions instead.

Returns

array —

The extension names.

gzcompress()

gzcompress(string  $data, int  $level = -1, int  $encoding = 15) : string|false

Parameters

string $data

The bytes to compress.

int $level

A zlib level, or -1 for the default.

int $encoding

A ZLIB_ENCODING_* value.

Returns

string|false —

gzdecode()

gzdecode(string  $data, int  $max_length = 0) : string|false

Parameters

string $data

The gzip stream.

int $max_length

The cap on the inflated size, or 0 for none.

Returns

string|false —

gzdeflate()

gzdeflate(string  $data, int  $level = -1, int  $encoding = -15) : string|false

Parameters

string $data

The bytes to compress.

int $level

A zlib level, or -1 for the default.

int $encoding

A ZLIB_ENCODING_* value.

Returns

string|false —

gzencode()

gzencode(string  $data, int  $level = -1, int  $encoding = 31) : string|false

Parameters

string $data

The bytes to compress.

int $level

A zlib level, or -1 for the default.

int $encoding

A ZLIB_ENCODING_* value.

Returns

string|false —

gzinflate()

gzinflate(string  $data, int  $max_length = 0) : string|false

Parameters

string $data

The raw deflate stream.

int $max_length

The cap on the inflated size, or 0 for none.

Returns

string|false —

gzuncompress()

gzuncompress(string  $data, int  $max_length = 0) : string|false

Parameters

string $data

The zlib stream.

int $max_length

The cap on the inflated size, or 0 for none.

Returns

string|false —

iconv_strrpos()

iconv_strrpos(string  $haystack, string  $needle, string|null  $encoding = null) : int|false

Parameters

string $haystack

The text to search.

string $needle

What to look for.

string|null $encoding

The charset of both, or NULL for the polyfill's internal one.

Returns

int|false —

mb_chr()

mb_chr(mixed  $codepoint, mixed  $encoding = null) : mixed

Parameters

mixed $codepoint
mixed $encoding

Returns

mixed —

mb_convert_case()

mb_convert_case(mixed  $string, mixed  $mode, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $mode
mixed $encoding

Returns

mixed —

mb_convert_encoding()

mb_convert_encoding(mixed  $string, mixed  $to_encoding, mixed  $from_encoding = null) : mixed

Parameters

mixed $string
mixed $to_encoding
mixed $from_encoding

Returns

mixed —

mb_encode_numericentity()

mb_encode_numericentity(mixed  $string, mixed  $map, mixed  $encoding = null, mixed  $hex = false) : mixed

Parameters

mixed $string
mixed $map
mixed $encoding
mixed $hex

Returns

mixed —

mb_ord()

mb_ord(mixed  $string, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $encoding

Returns

mixed —

mb_scrub()

mb_scrub(mixed  $string, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $encoding

Returns

mixed —

mb_str_split()

mb_str_split(mixed  $string, mixed  $length = 1, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $length
mixed $encoding

Returns

mixed —

mb_stripos()

mb_stripos(mixed  $haystack, mixed  $needle, mixed  $offset = 0, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $offset
mixed $encoding

Returns

mixed —

mb_stristr()

mb_stristr(mixed  $haystack, mixed  $needle, mixed  $before_needle = false, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $before_needle
mixed $encoding

Returns

mixed —

mb_strlen()

mb_strlen(mixed  $string, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $encoding

Returns

mixed —

mb_strpos()

mb_strpos(mixed  $haystack, mixed  $needle, mixed  $offset = 0, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $offset
mixed $encoding

Returns

mixed —

mb_strrchr()

mb_strrchr(mixed  $haystack, mixed  $needle, mixed  $before_needle = false, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $before_needle
mixed $encoding

Returns

mixed —

mb_strrichr()

mb_strrichr(mixed  $haystack, mixed  $needle, mixed  $before_needle = false, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $before_needle
mixed $encoding

Returns

mixed —

mb_strripos()

mb_strripos(mixed  $haystack, mixed  $needle, mixed  $offset = 0, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $offset
mixed $encoding

Returns

mixed —

mb_strrpos()

mb_strrpos(mixed  $haystack, mixed  $needle, mixed  $offset = 0, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $offset
mixed $encoding

Returns

mixed —

mb_strstr()

mb_strstr(mixed  $haystack, mixed  $needle, mixed  $before_needle = false, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $before_needle
mixed $encoding

Returns

mixed —

mb_strtolower()

mb_strtolower(mixed  $string, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $encoding

Returns

mixed —

mb_strtoupper()

mb_strtoupper(mixed  $string, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $encoding

Returns

mixed —

mb_strwidth()

mb_strwidth(mixed  $string, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $encoding

Returns

mixed —

mb_substr()

mb_substr(mixed  $string, mixed  $start, mixed  $length = null, mixed  $encoding = null) : mixed

Parameters

mixed $string
mixed $start
mixed $length
mixed $encoding

Returns

mixed —

mb_substr_count()

mb_substr_count(mixed  $haystack, mixed  $needle, mixed  $encoding = null) : mixed

Parameters

mixed $haystack
mixed $needle
mixed $encoding

Returns

mixed —

mime_content_type()

mime_content_type(string|resource  $filename) : string|false

Parameters

string|resource $filename

A path or an open stream.

Returns

string|false —

openssl_cipher_iv_length()

openssl_cipher_iv_length(string  $cipher_algo) : int|false

Parameters

string $cipher_algo

A cipher name.

Returns

int|false —

openssl_cipher_key_length()

openssl_cipher_key_length(string  $cipher_algo) : int|false

Parameters

string $cipher_algo

A cipher name.

Returns

int|false —

openssl_decrypt()

openssl_decrypt(string  $data, string  $cipher_algo, string  $passphrase, int  $options = 0, string  $iv = '', string|false|null  $tag = null, string  $aad = '') : string|false

Parameters

string $data

The ciphertext.

string $cipher_algo

A cipher name.

string $passphrase

The key material.

int $options

OPENSSL_RAW_DATA and OPENSSL_ZERO_PADDING flags.

string $iv

The initialisation vector.

string|false|null $tag

The GCM tag.

string $aad

Additional authenticated data, for GCM.

Returns

string|false —

openssl_encrypt()

openssl_encrypt(string  $data, string  $cipher_algo, string  $passphrase, int  $options = 0, string  $iv = '', string|false|null  $tag = null, string  $aad = '', int  $tag_length = 16) : string|false

Parameters

string $data

The plaintext.

string $cipher_algo

A cipher name.

string $passphrase

The key material.

int $options

OPENSSL_RAW_DATA and OPENSSL_ZERO_PADDING flags.

string $iv

The initialisation vector.

string|false|null $tag

Set to the GCM tag.

string $aad

Additional authenticated data, for GCM.

int $tag_length

The GCM tag length in bytes.

Returns

string|false —

openssl_error_string()

openssl_error_string() : string|false

Returns

string|false —

openssl_free_key()

openssl_free_key(\OpenSSLAsymmetricKey  $key) : void

Parameters

\OpenSSLAsymmetricKey $key

Returns

void —

openssl_get_cipher_methods()

openssl_get_cipher_methods(bool  $aliases = false) : list<string>

Parameters

bool $aliases

Ignored; there are no aliases here.

Returns

list —

openssl_get_privatekey()

openssl_get_privatekey(\OpenSSLAsymmetricKey|array|string  $private_key, string|null  $passphrase = null) : \OpenSSLAsymmetricKey|false

Parameters

\OpenSSLAsymmetricKey|array|string $private_key

A PEM, a key object or a file:// path.

string|null $passphrase

The passphrase the PEM was written with.

Returns

\OpenSSLAsymmetricKey|false —

openssl_get_publickey()

openssl_get_publickey(\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string  $public_key) : \OpenSSLAsymmetricKey|false

Parameters

\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $public_key

A PEM, a certificate, a file:// path or a JWK array.

Returns

\OpenSSLAsymmetricKey|false —

openssl_pkey_derive()

openssl_pkey_derive(\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string  $public_key, \OpenSSLAsymmetricKey|array|string  $private_key, int  $key_length = 0) : string|false

ECDH: the shared secret between a private key and a peer public key.

Parameters

\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $public_key

The peer's public key.

\OpenSSLAsymmetricKey|array|string $private_key

This side's private key.

int $key_length

Truncate the secret to this many bytes, or 0 for all of it.

Returns

string|false —

The secret, or FALSE.

openssl_pkey_export()

openssl_pkey_export(\OpenSSLAsymmetricKey|array|string  $key, string|null  $out, string|null  $passphrase = null) : bool

Writes a private key out as PEM.

PASSPHRASES ARE REFUSED rather than ignored. ext-openssl encrypts the output when one is given, and answering with an UNENCRYPTED key to a caller who asked for an encrypted one would hand them a secret they believe is protected.

Parameters

\OpenSSLAsymmetricKey|array|string $key

The key to export.

string|null $out

Set to the PEM.

string|null $passphrase

Refused when not empty.

Returns

bool —

TRUE on success.

openssl_pkey_free()

openssl_pkey_free(\OpenSSLAsymmetricKey  $key) : void

Parameters

\OpenSSLAsymmetricKey $key

Returns

void —

openssl_pkey_get_details()

openssl_pkey_get_details(\OpenSSLAsymmetricKey|array|string  $key) : array<string,mixed>|false

What ext-openssl reports about a key: bits, the public PEM, the type and its parameters.

Parameters

\OpenSSLAsymmetricKey|array|string $key

The key to describe.

Returns

array|false —

The details, or FALSE.

openssl_pkey_get_private()

openssl_pkey_get_private(\OpenSSLAsymmetricKey|array|string  $private_key, string|null  $passphrase = null) : \OpenSSLAsymmetricKey|false

Reads a private key, decrypting it with the passphrase when one was used to write it.

Parameters

\OpenSSLAsymmetricKey|array|string $private_key

A PEM, a key object or a file:// path.

string|null $passphrase

The passphrase the PEM was written with.

Returns

\OpenSSLAsymmetricKey|false —

The key, or FALSE.

openssl_pkey_get_public()

openssl_pkey_get_public(\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string  $public_key) : \OpenSSLAsymmetricKey|false

Turns a PEM, a certificate or a JWKS entry into a public key openssl_verify() accepts.

THE MISSING STEP IN EVERY OIDC LIBRARY. A provider publishes a key SET, the library reads the entry it needs and hands it here.

Parameters

\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $public_key

A PEM, a certificate, a file:// path or a JWK array.

Returns

\OpenSSLAsymmetricKey|false —

The public key, or FALSE.

openssl_pkey_new()

openssl_pkey_new(array|null  $options = null) : \OpenSSLAsymmetricKey|false

A new RSA or EC key pair.

Parameters

array|null $options

private_key_bits, private_key_type or curve_name.

Returns

\OpenSSLAsymmetricKey|false —

The key, or FALSE.

openssl_private_decrypt()

openssl_private_decrypt(string  $data, string|false|null  $decrypted_data, \OpenSSLAsymmetricKey|array|string  $private_key, int  $padding = 1) : bool

Parameters

string $data

The bytes to decrypt.

string|false|null $decrypted_data

Set to the result.

\OpenSSLAsymmetricKey|array|string $private_key

The key.

int $padding

OPENSSL_PKCS1_PADDING or OPENSSL_PKCS1_OAEP_PADDING.

Returns

bool —

openssl_private_encrypt()

openssl_private_encrypt(string  $data, string|false|null  $encrypted_data, \OpenSSLAsymmetricKey|array|string  $private_key, int  $padding = 1) : bool

RSA sign-with-private, which is what a legacy licence check or an older SSO handshake uses.

Parameters

string $data

The bytes to encrypt.

string|false|null $encrypted_data

Set to the result.

\OpenSSLAsymmetricKey|array|string $private_key

The key.

int $padding

An OPENSSL_*_PADDING value; ignored here.

Returns

bool —

TRUE on success.

openssl_public_decrypt()

openssl_public_decrypt(string  $data, string|false|null  $decrypted_data, \OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string  $public_key, int  $padding = 1) : bool

The other half of the pair above.

Parameters

string $data

The bytes to decrypt.

string|false|null $decrypted_data

Set to the result.

\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $public_key

The key.

int $padding

An OPENSSL_*_PADDING value; ignored here.

Returns

bool —

TRUE on success.

openssl_public_encrypt()

openssl_public_encrypt(string  $data, string|false|null  $encrypted_data, \OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string  $public_key, int  $padding = 1) : bool

Encrypt to a public key, PKCS#1 v1.5 or OAEP, which is how XML encryption wraps its key.

Parameters

string $data

The bytes to encrypt.

string|false|null $encrypted_data

Set to the result.

\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $public_key

The key.

int $padding

OPENSSL_PKCS1_PADDING or OPENSSL_PKCS1_OAEP_PADDING.

Returns

bool —

TRUE on success.

openssl_random_pseudo_bytes()

openssl_random_pseudo_bytes(int  $length, bool|null  $strong_result = null) : string

Parameters

int $length

The number of bytes.

bool|null $strong_result

Set to TRUE, since the bytes come from random_bytes().

Returns

string —

openssl_sign()

openssl_sign(string  $data, string|false|null  $signature, \OpenSSLAsymmetricKey|array|string  $private_key, int|string  $algorithm = 1) : bool

Parameters

string $data

The bytes to sign.

string|false|null $signature

Set to the raw signature.

\OpenSSLAsymmetricKey|array|string $private_key

The signing key.

int|string $algorithm

An OPENSSL_ALGO_* value or a digest name.

Returns

bool —

openssl_verify()

openssl_verify(string  $data, string  $signature, \OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string  $public_key, int|string  $algorithm = 1) : int

Answers 1, 0 or -1, matching ext-openssl.

-1 means the call itself failed -- an unreadable key, an unsupported digest -- and is NOT the same as 0, which means the signature was read and did not match. A caller treating -1 as "invalid" would report a broken key as a forged token.

Parameters

string $data

The signed bytes.

string $signature

The raw signature.

\OpenSSLAsymmetricKey|\OpenSSLCertificate|array|string $public_key

The verification key.

int|string $algorithm

An OPENSSL_ALGO_* value or a digest name.

Returns

int —

openssl_x509_checkpurpose()

openssl_x509_checkpurpose(\OpenSSLCertificate|string  $certificate, int  $purpose, array  $ca_info = [], string|null  $untrusted_certificates_file = null) : int

Purpose checking needs a trust store and purpose table this runtime does not carry.

Parameters

\OpenSSLCertificate|string $certificate

The certificate to check.

int $purpose

An X509_PURPOSE_* value.

array $ca_info

Trusted CA locations.

string|null $untrusted_certificates_file

Intermediate certificates.

Returns

int —

-1, which ext-openssl uses for "could not be determined".

openssl_x509_export()

openssl_x509_export(\OpenSSLCertificate|string  $certificate, string|null  $output, bool  $no_text = true) : bool

Parameters

\OpenSSLCertificate|string $certificate

A PEM, a file:// path or a certificate object.

string|null $output

Set to the PEM.

bool $no_text

Ignored.

Returns

bool —

openssl_x509_fingerprint()

openssl_x509_fingerprint(\OpenSSLCertificate|string  $certificate, string  $digest_algo = 'sha1', bool  $binary = false) : string|false

Parameters

\OpenSSLCertificate|string $certificate

A PEM, a file:// path or a certificate object.

string $digest_algo

A digest name.

bool $binary

Return raw bytes instead of hex.

Returns

string|false —

openssl_x509_free()

openssl_x509_free(\OpenSSLCertificate  $certificate) : void

Parameters

\OpenSSLCertificate $certificate

Returns

void —

openssl_x509_parse()

openssl_x509_parse(\OpenSSLCertificate|string  $certificate, bool  $short_names = true) : array<string,mixed>|false

The fields of a certificate that node:crypto exposes, under ext-openssl's key names.

Parameters

\OpenSSLCertificate|string $certificate

A PEM, a file:// path or a certificate object.

bool $short_names

Ignored.

Returns

array|false —

The parsed certificate, or FALSE.

openssl_x509_read()

openssl_x509_read(\OpenSSLCertificate|string  $certificate) : \OpenSSLCertificate|false

Reads a certificate from PEM, a file:// path or another certificate.

Parameters

\OpenSSLCertificate|string $certificate

A PEM, a file:// path or a certificate object.

Returns

\OpenSSLCertificate|false —

The certificate, or FALSE.

passthru()

passthru(string  $command, int|null  $result_code = null) : false|null

Parameters

string $command

The command line.

int|null $result_code

Set to the exit code.

Returns

false|null —

pclose()

pclose(resource  $handle) : int

Parameters

resource $handle

Returns

int —

popen()

popen(string  $command, string  $mode) : resource|false

Parameters

string $command

The command line.

string $mode

r or w.

Returns

resource|false —

proc_close()

proc_close(resource  $process) : int

Parameters

resource $process

Returns

int —

proc_get_status()

proc_get_status(resource  $process) : array<string,mixed>|false

Parameters

resource $process

A handle from proc_open().

Returns

array|false —

proc_open()

proc_open(array|string  $command, array  $descriptor_spec, array  $pipes, string|null  $cwd = null, array|null  $env_vars = null, array|null  $options = null) : resource|false

Parameters

array|string $command

The command line.

array $descriptor_spec

The pipes to open.

array $pipes

Set to the opened pipes.

string|null $cwd

Working directory.

array|null $env_vars

Environment.

array|null $options

Platform options.

Returns

resource|false —

proc_terminate()

proc_terminate(resource  $process, int  $signal = 15) : bool

Parameters

resource $process

A handle from proc_open().

int $signal

The signal number.

Returns

bool —

shell_exec()

shell_exec(string  $command) : string|false|null

Parameters

string $command

The command line.

Returns

string|false|null —

sleep()

sleep(int  $seconds) : int

Parameters

int $seconds

Returns

int —

sodium_add()

sodium_add(mixed  $string1, mixed  $string2) : mixed

Parameters

mixed $string1
mixed $string2

Returns

mixed —

sodium_base642bin()

sodium_base642bin(mixed  $string, mixed  $id, mixed  $ignore = '') : mixed

Parameters

mixed $string
mixed $id
mixed $ignore

Returns

mixed —

sodium_bin2base64()

sodium_bin2base64(mixed  $string, mixed  $id) : mixed

Parameters

mixed $string
mixed $id

Returns

mixed —

sodium_bin2hex()

sodium_bin2hex(mixed  $string) : mixed

Parameters

mixed $string

Returns

mixed —

sodium_compare()

sodium_compare(mixed  $string1, mixed  $string2) : mixed

Parameters

mixed $string1
mixed $string2

Returns

mixed —

sodium_hex2bin()

sodium_hex2bin(mixed  $string, mixed  $ignore = '') : mixed

Parameters

mixed $string
mixed $ignore

Returns

mixed —

sodium_increment()

sodium_increment(mixed  $string) : mixed

Parameters

mixed $string

Returns

mixed —

sodium_memcmp()

sodium_memcmp(mixed  $string1, mixed  $string2) : mixed

Parameters

mixed $string1
mixed $string2

Returns

mixed —

sodium_memzero()

sodium_memzero(mixed  $string) : mixed

Parameters

mixed $string

Returns

mixed —

sodium_pad()

sodium_pad(mixed  $string, mixed  $block_size) : mixed

Parameters

mixed $string
mixed $block_size

Returns

mixed —

sodium_unpad()

sodium_unpad(mixed  $string, mixed  $block_size) : mixed

Parameters

mixed $string
mixed $block_size

Returns

mixed —

system()

system(string  $command, int|null  $result_code = null) : string|false

Parameters

string $command

The command line.

int|null $result_code

Set to the exit code.

Returns

string|false —

time_nanosleep()

time_nanosleep(int  $seconds, int  $nanoseconds) : bool

Parameters

int $seconds

Whole seconds.

int $nanoseconds

Nanoseconds past the seconds.

Returns

bool —

time_sleep_until()

time_sleep_until(float  $timestamp) : bool

Parameters

float $timestamp

Returns

bool —

transliterator_create()

transliterator_create(string  $id, int  $direction = 0) : object|null

Parameters

string $id

A transliterator rule id.

int $direction

0 for forward.

Returns

object|null —

transliterator_transliterate()

transliterator_transliterate(object|string  $transliterator, string  $string, int  $start = 0, int  $end = -1) : string|false

Parameters

object|string $transliterator

A transliterator or a rule id.

string $string

The text to transliterate.

int $start

First byte to transliterate.

int $end

One past the last byte, or -1 for the rest.

Returns

string|false —

uniqid()

uniqid(string  $prefix = '', bool  $more_entropy = false) : string

Parameters

string $prefix
bool $more_entropy

Returns

string —

usleep()

usleep(int  $microseconds) : void

Parameters

int $microseconds

Returns

void —

zstd_compress()

zstd_compress(string  $data, int  $level = 3, string|null  $dict = null) : string|false

Compresses a string with zstd.

Parameters

string $data

The bytes to compress.

int $level

A zstd level, 1 to 22 (or zero and below).

string|null $dict

A preset dictionary, or NULL for none.

Returns

string|false —

The compressed bytes, or FALSE on failure.

zstd_compress_dict()

zstd_compress_dict(string  $data, string  $dict, int  $level = 3) : string|false

Compresses a string with zstd and a required dictionary.

Parameters

string $data

The bytes to compress.

string $dict

The dictionary; required.

int $level

A zstd level, 1 to 22 (or zero and below).

Returns

string|false —

The compressed bytes, or FALSE on failure.

zstd_decompress()

zstd_decompress(string  $data, string|null  $dict = null) : string|false

The alias ext-zstd documents beside zstd_uncompress().

Parameters

string $data

The zstd frame.

string|null $dict

The dictionary the frame was compressed with, or NULL for none.

Returns

string|false —

The decompressed bytes, or FALSE on failure.

zstd_uncompress()

zstd_uncompress(string  $data, string|null  $dict = null) : string|false

Decompresses a zstd frame.

Parameters

string $data

The zstd frame.

string|null $dict

The dictionary the frame was compressed with, or NULL for none.

Returns

string|false —

The decompressed bytes, or FALSE on failure.

zstd_uncompress_dict()

zstd_uncompress_dict(string  $data, string  $dict) : string|false

Decompresses a zstd frame with a required dictionary.

Parameters

string $data

The zstd frame.

string $dict

The dictionary the frame was compressed with; required.

Returns

string|false —

The decompressed bytes, or FALSE on failure.