drupflare/worker - v1.0.4
    Preparing search index...

    Variable CURL_FIX_PHPConst

    CURL_FIX_PHP: "\nuse Drupal\\drupflare\\Degradation;\nuse Drupal\\drupflare\\Shim\\CurlShim;\n\nif (!extension_loaded('curl') && !function_exists('cfw_curl_installed')) {\n\t// __CFW_CURL_OPTIONS__\n\t// __CFW_CURL_INERT__\n\n\tfunction cfw_curl_installed(): bool\n\t{\n\t\treturn true;\n\t}\n\n\t/**\n\t * The one shim instance, resolved on FIRST USE rather than at declaration time.\n\t *\n\t * This fragment runs from ensurePhp(), which is before Drupal's autoloader exists, so a\n\t * class_exists() guard around the declarations would never pass and the functions would\n\t * never be declared at all. Resolving here instead means the class is looked up when a\n\t * caller actually makes a request, by which time the module is loaded.\n\t *\n\t * @return CurlShim|null\n\t * NULL when the module is not loaded, which every caller below treats as a refusal.\n\t */\n\tfunction cfw_curl_shim()\n\t{\n\t\tstatic $shim = null;\n\t\tif ($shim === null && class_exists(CurlShim::class)) {\n\t\t\t$shim = new CurlShim();\n\t\t}\n\t\treturn $shim;\n\t}\n\n\t/**\n\t * Declares the gap once, then answers the way curl answers a connection it cannot make.\n\t *\n\t * Never silently absent. Without the module there is no queue to defer into, so the\n\t * honest answer is the same FALSE a caller already handles -- but an operator gets a\n\t * status-report row saying why instead of an unexplained failure.\n\t */\n\tfunction cfw_curl_absent(): false\n\t{\n\t\tif (class_exists(Degradation::class)) {\n\t\t\tDegradation::record(\n\t\t\t\t'curl_*',\n\t\t\t\t'the drupflare module is not loaded, so there is no deferred-HTTP queue to route curl through',\n\t\t\t);\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param string|null $url\n\t * The URL to request, or NULL to set it later.\n\t *\n\t * @return array<string, mixed>|false\n\t * The opaque handle, or FALSE when the shim is unavailable.\n\t */\n\tfunction curl_init($url = null)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\tif ($shim === null) {\n\t\t\treturn cfw_curl_absent();\n\t\t}\n\t\treturn $shim->init($url === null ? null : (string) $url);\n\t}\n\n\t/**\n\t * @param array<mixed>|false $handle\n\t * The handle curl_init() returned.\n\t * @param int $option\n\t * A CURLOPT_* constant.\n\t * @param mixed $value\n\t * The option value.\n\t *\n\t * @return bool\n\t */\n\tfunction curl_setopt(&$handle, $option, $value)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\tif ($shim === null || !is_array($handle)) {\n\t\t\treturn cfw_curl_absent();\n\t\t}\n\t\treturn $shim->setopt($handle, (int) $option, $value);\n\t}\n\n\t/**\n\t * @param array<mixed>|false $handle\n\t * The handle curl_init() returned.\n\t * @param array<int, mixed> $options\n\t * CURLOPT_* constants mapped to their values.\n\t *\n\t * @return bool\n\t */\n\tfunction curl_setopt_array(&$handle, $options)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\tif ($shim === null || !is_array($handle)) {\n\t\t\treturn cfw_curl_absent();\n\t\t}\n\t\treturn $shim->setoptArray($handle, (array) $options);\n\t}\n\n\t/**\n\t * @param array<mixed>|false $handle\n\t * The handle curl_init() returned.\n\t *\n\t * @return string|bool\n\t */\n\tfunction curl_exec(&$handle)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\tif ($shim === null || !is_array($handle)) {\n\t\t\treturn cfw_curl_absent();\n\t\t}\n\t\treturn $shim->exec($handle);\n\t}\n\n\t/**\n\t * @param array<mixed>|false $handle\n\t * The handle curl_init() returned.\n\t * @param int|null $key\n\t * A CURLINFO_* constant, or NULL for every field.\n\t *\n\t * @return mixed\n\t */\n\tfunction curl_getinfo($handle, $key = null)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\tif ($shim === null || !is_array($handle)) {\n\t\t\treturn cfw_curl_absent();\n\t\t}\n\t\treturn $shim->getinfo($handle, $key);\n\t}\n\n\t/**\n\t * @param array<mixed>|false $handle\n\t * The handle curl_init() returned.\n\t */\n\tfunction curl_reset(&$handle)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\tif ($shim !== null && is_array($handle)) {\n\t\t\t$shim->reset($handle);\n\t\t}\n\t}\n\n\t/**\n\t * @param array<mixed>|false $handle\n\t * The handle curl_init() returned.\n\t *\n\t * @return int\n\t */\n\tfunction curl_errno($handle)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\t// 7 is CURLE_COULDNT_CONNECT, which is what \"there was no transport\" really is\n\t\tif ($shim === null || !is_array($handle)) {\n\t\t\treturn 7;\n\t\t}\n\t\treturn $shim->errno($handle);\n\t}\n\n\t/**\n\t * @param array<mixed>|false $handle\n\t * The handle curl_init() returned.\n\t *\n\t * @return string\n\t */\n\tfunction curl_error($handle)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\tif ($shim === null || !is_array($handle)) {\n\t\t\treturn 'drupflare: curl shim unavailable';\n\t\t}\n\t\treturn $shim->error($handle);\n\t}\n\n\t/**\n\t * @param array<mixed>|false $handle\n\t * The handle curl_init() returned.\n\t */\n\tfunction curl_close(&$handle)\n\t{\n\t\t$shim = cfw_curl_shim();\n\t\tif ($shim !== null && is_array($handle)) {\n\t\t\t$shim->close($handle);\n\t\t}\n\t}\n\n\t/**\n\t * Reports a version the way ext-curl does, so a caller's feature test has something to read.\n\t *\n\t * The version string names this shim rather than a curl release: a caller comparing against\n\t * a real curl version must not conclude a feature is present because the number looked new\n\t * enough.\n\t *\n\t * @return array<string, mixed>\n\t */\n\tfunction curl_version(): array\n\t{\n\t\treturn [\n\t\t\t'version' => '0.0.0-drupflare-shim',\n\t\t\t'version_number' => 0,\n\t\t\t'features' => 0,\n\t\t\t'ssl_version' => '',\n\t\t\t'protocols' => ['http', 'https'],\n\t\t];\n\t}\n}\n"