Variable ZSTD_FIX_PHPConst
ZSTD_FIX_PHP: "\n// ext-zstd stand-in over the host bridge. Declared only where the extension is absent and the\n// bridge resolves. A conditional declaration binds at runtime, so this lints clean on a build that\n// HAS zstd and the branch does not run.\nif (!function_exists('zstd_compress') && function_exists('vrzno_env')) {\n\t$__cfw_zstd = vrzno_env('cfwZstd');\n\tif ($__cfw_zstd !== null) {\n\t\t$GLOBALS['__cfw_zstd'] = $__cfw_zstd;\n\n\t\t// the values ext-zstd 0.18 declares\n\t\tif (!defined('ZSTD_COMPRESS_LEVEL_MIN')) {\n\t\t\tdefine('ZSTD_COMPRESS_LEVEL_MIN', 1);\n\t\t}\n\t\tif (!defined('ZSTD_COMPRESS_LEVEL_MAX')) {\n\t\t\tdefine('ZSTD_COMPRESS_LEVEL_MAX', 22);\n\t\t}\n\t\tif (!defined('ZSTD_COMPRESS_LEVEL_DEFAULT')) {\n\t\t\tdefine('ZSTD_COMPRESS_LEVEL_DEFAULT', 3);\n\t\t}\n\n\t\t/**\n\t\t * Runs one op over the bridge.\n\t\t *\n\t\t * @param string $op\n\t\t * The operation, compress or uncompress.\n\t\t * @param string $data\n\t\t * The bytes to transform.\n\t\t * @param int $level\n\t\t * A zstd level, 1 to 22 (or zero and below).\n\t\t * @param string $dict\n\t\t * A preset dictionary, or an empty string for none.\n\t\t *\n\t\t * @return array{ok: bool, data?: string, error?: string}\n\t\t * The decoded reply, or the reason it failed.\n\t\t */\n\t\tfunction cfw_zstd($op, $data, $level = 3, $dict = ''): array\n\t\t{\n\t\t\t$fn = $GLOBALS['__cfw_zstd'];\n\t\t\t$reply = json_decode(\n\t\t\t\t$fn(\n\t\t\t\t\tjson_encode([\n\t\t\t\t\t\t'op' => $op,\n\t\t\t\t\t\t'b64' => base64_encode((string) $data),\n\t\t\t\t\t\t'level' => $level,\n\t\t\t\t\t\t'dict' => base64_encode((string) $dict),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\ttrue,\n\t\t\t);\n\t\t\tif (!is_array($reply) || ($reply['ok'] ?? false) !== true) {\n\t\t\t\t$why = is_array($reply)\n\t\t\t\t\t? (string) ($reply['error'] ?? 'no reason given')\n\t\t\t\t\t: 'unreadable reply';\n\t\t\t\treturn ['ok' => false, 'error' => $why];\n\t\t\t}\n\t\t\t$out = base64_decode((string) ($reply['b64'] ?? ''), true);\n\t\t\tif ($out === false) {\n\t\t\t\treturn ['ok' => false, 'error' => 'reply was not base64'];\n\t\t\t}\n\t\t\treturn ['ok' => true, 'data' => $out];\n\t\t}\n\n\t\t/**\n\t\t * Raises the diagnostic ext-zstd raises, then answers FALSE like it does.\n\t\t *\n\t\t * @param string $name\n\t\t * The PHP function that failed.\n\t\t * @param string $reason\n\t\t * What ext-zstd would have said.\n\t\t */\n\t\tfunction cfw_zstd_fail($name, $reason): false\n\t\t{\n\t\t\ttrigger_error($name . '(): ' . $reason, E_USER_WARNING);\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n\t\t * Compresses a string with zstd.\n\t\t *\n\t\t * @param string $data\n\t\t * The bytes to compress.\n\t\t * @param int $level\n\t\t * A zstd level, 1 to 22 (or zero and below).\n\t\t * @param string|null $dict\n\t\t * A preset dictionary, or NULL for none.\n\t\t *\n\t\t * @return string|false\n\t\t * The compressed bytes, or FALSE on failure.\n\t\t */\n\t\tfunction zstd_compress($data, $level = 3, $dict = null)\n\t\t{\n\t\t\t$r = cfw_zstd('compress', $data, $level, $dict ?? '');\n\t\t\treturn $r['ok'] ? $r['data'] : cfw_zstd_fail('zstd_compress', $r['error']);\n\t\t}\n\n\t\t/**\n\t\t * Decompresses a zstd frame.\n\t\t *\n\t\t * @param string $data\n\t\t * The zstd frame.\n\t\t * @param string|null $dict\n\t\t * The dictionary the frame was compressed with, or NULL for none.\n\t\t *\n\t\t * @return string|false\n\t\t * The decompressed bytes, or FALSE on failure.\n\t\t */\n\t\tfunction zstd_uncompress($data, $dict = null)\n\t\t{\n\t\t\t$r = cfw_zstd('uncompress', $data, 3, $dict ?? '');\n\t\t\treturn $r['ok'] ? $r['data'] : cfw_zstd_fail('zstd_uncompress', $r['error']);\n\t\t}\n\n\t\t/**\n\t\t * The alias ext-zstd documents beside zstd_uncompress().\n\t\t *\n\t\t * @param string $data\n\t\t * The zstd frame.\n\t\t * @param string|null $dict\n\t\t * The dictionary the frame was compressed with, or NULL for none.\n\t\t *\n\t\t * @return string|false\n\t\t * The decompressed bytes, or FALSE on failure.\n\t\t */\n\t\tfunction zstd_decompress($data, $dict = null)\n\t\t{\n\t\t\t$r = cfw_zstd('uncompress', $data, 3, $dict ?? '');\n\t\t\treturn $r['ok'] ? $r['data'] : cfw_zstd_fail('zstd_decompress', $r['error']);\n\t\t}\n\n\t\t/**\n\t\t * Compresses a string with zstd and a required dictionary.\n\t\t *\n\t\t * @param string $data\n\t\t * The bytes to compress.\n\t\t * @param string $dict\n\t\t * The dictionary; required.\n\t\t * @param int $level\n\t\t * A zstd level, 1 to 22 (or zero and below).\n\t\t *\n\t\t * @return string|false\n\t\t * The compressed bytes, or FALSE on failure.\n\t\t */\n\t\tfunction zstd_compress_dict($data, $dict, $level = 3)\n\t\t{\n\t\t\t$r = cfw_zstd('compress', $data, $level, (string) $dict);\n\t\t\treturn $r['ok'] ? $r['data'] : cfw_zstd_fail('zstd_compress_dict', $r['error']);\n\t\t}\n\n\t\t/**\n\t\t * Decompresses a zstd frame with a required dictionary.\n\t\t *\n\t\t * @param string $data\n\t\t * The zstd frame.\n\t\t * @param string $dict\n\t\t * The dictionary the frame was compressed with; required.\n\t\t *\n\t\t * @return string|false\n\t\t * The decompressed bytes, or FALSE on failure.\n\t\t */\n\t\tfunction zstd_uncompress_dict($data, $dict)\n\t\t{\n\t\t\t$r = cfw_zstd('uncompress', $data, 3, (string) $dict);\n\t\t\treturn $r['ok'] ? $r['data'] : cfw_zstd_fail('zstd_uncompress_dict', $r['error']);\n\t\t}\n\t}\n}\n"